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#ifndef FPDFSDK_PWL_CPWL_ICON_H_
8#define FPDFSDK_PWL_CPWL_ICON_H_
9
10#include <utility>
11
12#include "core/fxcrt/fx_string.h"
13#include "core/fxcrt/unowned_ptr.h"
14#include "fpdfsdk/pwl/cpwl_wnd.h"
15
16class CPWL_Icon : public CPWL_Wnd {
17 public:
18  CPWL_Icon();
19  ~CPWL_Icon() override;
20
21  void SetIconFit(CPDF_IconFit* pIconFit) { m_pIconFit = pIconFit; }
22  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();
31  ByteString GetImageAlias();
32
33 private:
34  // left, bottom
35  std::pair<float, float> GetIconPosition();
36
37  // width, height
38  std::pair<float, float> GetImageSize();
39
40  UnownedPtr<CPDF_Stream> m_pPDFStream;
41  UnownedPtr<CPDF_IconFit> m_pIconFit;
42};
43
44#endif  // FPDFSDK_PWL_CPWL_ICON_H_
45