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