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 <memory> 11 #include <utility> 12 13 #include "core/fxcrt/fx_string.h" 14 #include "core/fxcrt/unowned_ptr.h" 15 #include "fpdfsdk/pwl/cpwl_wnd.h" 16 17 class CPDF_Icon; 18 class CPDF_IconFit; 19 20 class CPWL_Icon final : public CPWL_Wnd { 21 public: 22 CPWL_Icon(const CreateParams& cp, 23 std::unique_ptr<CPDF_Icon> pIcon, 24 CPDF_IconFit* pFit); 25 ~CPWL_Icon() override; 26 27 // horizontal scale, vertical scale 28 std::pair<float, float> GetScale(); 29 30 // x, y 31 std::pair<float, float> GetImageOffset(); 32 33 CFX_Matrix GetImageMatrix(); 34 ByteString GetImageAlias(); 35 36 private: 37 CFX_PointF GetIconPosition(); // left, bottom coordinates. 38 CFX_SizeF GetImageSize(); 39 40 std::unique_ptr<CPDF_Icon> const m_pIcon; 41 UnownedPtr<CPDF_IconFit> const m_pIconFit; 42 }; 43 44 #endif // FPDFSDK_PWL_CPWL_ICON_H_ 45