K. Moon | 832a694 | 2022-10-31 20:11:31 +0000 | [diff] [blame] | 1 | // Copyright 2014 The PDFium Authors |
Tom Sepez | 99ffdb0 | 2016-01-26 14:51:21 -0800 | [diff] [blame] | 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 | |
dsinclair | 447b1f3 | 2016-12-08 10:06:32 -0800 | [diff] [blame] | 7 | #include "xfa/fwl/cfwl_picturebox.h" |
Dan Sinclair | e73c5ce | 2016-02-25 13:38:37 -0500 | [diff] [blame] | 8 | |
Tom Sepez | 0a9d974 | 2020-09-01 21:40:52 +0000 | [diff] [blame] | 9 | CFWL_PictureBox::CFWL_PictureBox(CFWL_App* app) |
Tom Sepez | 5f4456e | 2020-08-14 20:22:02 +0000 | [diff] [blame] | 10 | : CFWL_Widget(app, CFWL_Widget::Properties(), nullptr) {} |
weili | 4ce94e1 | 2016-06-18 06:21:57 -0700 | [diff] [blame] | 11 | |
Lei Zhang | 0e744a2 | 2020-06-02 00:44:28 +0000 | [diff] [blame] | 12 | CFWL_PictureBox::~CFWL_PictureBox() = default; |
dsinclair | eb3f68c | 2016-11-07 10:28:47 -0800 | [diff] [blame] | 13 | |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 14 | FWL_Type CFWL_PictureBox::GetClassID() const { |
| 15 | return FWL_Type::PictureBox; |
dsinclair | eb3f68c | 2016-11-07 10:28:47 -0800 | [diff] [blame] | 16 | } |
| 17 | |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 18 | void CFWL_PictureBox::Update() { |
| 19 | if (IsLocked()) |
| 20 | return; |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 21 | |
Tom Sepez | c43d5f2 | 2020-05-06 22:47:51 +0000 | [diff] [blame] | 22 | m_ClientRect = GetClientRect(); |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 23 | } |
| 24 | |
Tom Sepez | 45eae7b | 2020-10-13 22:50:53 +0000 | [diff] [blame] | 25 | void CFWL_PictureBox::DrawWidget(CFGAS_GEGraphics* pGraphics, |
Lei Zhang | 4b47214 | 2017-08-17 14:30:08 -0700 | [diff] [blame] | 26 | const CFX_Matrix& matrix) { |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 27 | if (!pGraphics) |
| 28 | return; |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 29 | |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 30 | if (HasBorder()) |
Lei Zhang | 58842d1 | 2021-06-05 01:38:48 +0000 | [diff] [blame] | 31 | DrawBorder(pGraphics, CFWL_ThemePart::Part::kBorder, matrix); |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 32 | } |
| 33 | |
Tom Sepez | 45eae7b | 2020-10-13 22:50:53 +0000 | [diff] [blame] | 34 | void CFWL_PictureBox::OnDrawWidget(CFGAS_GEGraphics* pGraphics, |
Lei Zhang | 4b47214 | 2017-08-17 14:30:08 -0700 | [diff] [blame] | 35 | const CFX_Matrix& matrix) { |
| 36 | DrawWidget(pGraphics, matrix); |
dsinclair | 2c489cc | 2016-11-23 16:17:20 -0800 | [diff] [blame] | 37 | } |