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