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 "Icon.h" 8 9#include "JS_Define.h" 10#include "JS_Object.h" 11#include "JS_Value.h" 12#include "fpdfsdk/include/javascript/IJavaScript.h" 13 14/* ---------------------- Icon ---------------------- */ 15 16BEGIN_JS_STATIC_CONST(CJS_Icon) 17END_JS_STATIC_CONST() 18 19BEGIN_JS_STATIC_PROP(CJS_Icon) 20JS_STATIC_PROP_ENTRY(name) 21END_JS_STATIC_PROP() 22 23BEGIN_JS_STATIC_METHOD(CJS_Icon) 24END_JS_STATIC_METHOD() 25 26IMPLEMENT_JS_CLASS(CJS_Icon, Icon) 27 28Icon::Icon(CJS_Object* pJSObject) 29 : CJS_EmbedObj(pJSObject), m_pIconStream(NULL), m_swIconName(L"") {} 30 31Icon::~Icon() {} 32 33void Icon::SetStream(CPDF_Stream* pIconStream) { 34 if (pIconStream) 35 m_pIconStream = pIconStream; 36} 37 38CPDF_Stream* Icon::GetStream() { 39 return m_pIconStream; 40} 41 42void Icon::SetIconName(CFX_WideString name) { 43 m_swIconName = name; 44} 45 46CFX_WideString Icon::GetIconName() { 47 return m_swIconName; 48} 49 50FX_BOOL Icon::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { 51 if (!vp.IsGetting()) 52 return FALSE; 53 54 vp << m_swIconName; 55 return TRUE; 56} 57