Initial commit.
[pdfium.git] / fpdfsdk / src / javascript / Icon.cpp
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4  \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #include "../../include/javascript/JavaScript.h"\r
8 #include "../../include/javascript/IJavaScript.h"\r
9 #include "../../include/javascript/JS_Define.h"\r
10 #include "../../include/javascript/JS_Object.h"\r
11 #include "../../include/javascript/JS_Value.h"\r
12 #include "../../include/javascript/Icon.h"\r
13 \r
14 /* ---------------------- Icon ---------------------- */\r
15 \r
16 BEGIN_JS_STATIC_CONST(CJS_Icon)\r
17 END_JS_STATIC_CONST()\r
18 \r
19 BEGIN_JS_STATIC_PROP(CJS_Icon)\r
20         JS_STATIC_PROP_ENTRY(name)\r
21 END_JS_STATIC_PROP()\r
22 \r
23 BEGIN_JS_STATIC_METHOD(CJS_Icon) \r
24 END_JS_STATIC_METHOD()\r
25 \r
26 IMPLEMENT_JS_CLASS(CJS_Icon,Icon)\r
27 \r
28 Icon::Icon(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject),\r
29         m_pIconStream(NULL),\r
30         m_swIconName(L"")\r
31 {\r
32 }\r
33 \r
34 Icon::~Icon()\r
35 {\r
36 \r
37 }\r
38 \r
39 void Icon::SetStream(CPDF_Stream* pIconStream)\r
40 {\r
41         if(pIconStream)\r
42                 m_pIconStream = pIconStream;\r
43 }\r
44 \r
45 CPDF_Stream* Icon::GetStream()\r
46 {\r
47         return m_pIconStream;\r
48 }\r
49 \r
50 void Icon::SetIconName(CFX_WideString name)\r
51 {\r
52         m_swIconName = name;\r
53 }\r
54 \r
55 CFX_WideString Icon::GetIconName()\r
56 {\r
57         return m_swIconName;\r
58 }\r
59 \r
60 FX_BOOL Icon::name(OBJ_PROP_PARAMS)\r
61 {\r
62         if(!vp.IsGetting())return FALSE;\r
63 \r
64         vp << m_swIconName;\r
65         return TRUE;\r
66 }\r
67 \r