blob: df88465a5a611cb79e16678910b52a2599f906a8 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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.
Lei Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Dan Sinclairc411eb92017-07-25 09:39:30 -04007#ifndef FPDFSDK_PWL_CPWL_ICON_H_
8#define FPDFSDK_PWL_CPWL_ICON_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Dan Sinclairdc11ec82017-07-20 11:08:03 -040010#include <utility>
11
dsinclaira52ab742016-09-29 13:59:29 -070012#include "core/fxcrt/fx_string.h"
Dan Sinclairaee0db02017-09-21 16:53:58 -040013#include "core/fxcrt/unowned_ptr.h"
Dan Sinclairc411eb92017-07-25 09:39:30 -040014#include "fpdfsdk/pwl/cpwl_wnd.h"
Tom Sepez870292c2015-04-07 16:12:46 -070015
Dan Sinclairdc11ec82017-07-20 11:08:03 -040016class CPWL_Icon : public CPWL_Wnd {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070017 public:
18 CPWL_Icon();
Lei Zhang2b1a2d52015-08-14 22:16:22 -070019 ~CPWL_Icon() override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020
Lei Zhang09985382015-08-14 22:23:47 -070021 void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; }
Dan Sinclairdc11ec82017-07-20 11:08:03 -040022 void SetPDFStream(CPDF_Stream* pStream) { m_pPDFStream = pStream; }
23
24 // horizontal scale, vertical scale
25 std::pair<float, float> GetScale();
26
27 // x, y
28 std::pair<float, float> GetImageOffset();
29
30 CFX_Matrix GetImageMatrix();
Ryan Harrison275e2602017-09-18 14:23:18 -040031 ByteString GetImageAlias();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070032
Nico Weber9d8ec5a2015-08-04 13:00:21 -070033 private:
Dan Sinclairdc11ec82017-07-20 11:08:03 -040034 // left, bottom
35 std::pair<float, float> GetIconPosition();
36
37 // width, height
38 std::pair<float, float> GetImageSize();
39
Dan Sinclairaee0db02017-09-21 16:53:58 -040040 UnownedPtr<CPDF_Stream> m_pPDFStream;
41 UnownedPtr<CPDF_IconFit> m_pIconFit;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070042};
43
Dan Sinclairc411eb92017-07-25 09:39:30 -040044#endif // FPDFSDK_PWL_CPWL_ICON_H_