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 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ |
9 | 9 |
10 #include "../fsdk_define.h" // For FX_UINT | 10 #include "../fsdk_define.h" // For FX_UINT |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 virtual void TimerProc(CJS_Timer* pTimer){}; | 26 virtual void TimerProc(CJS_Timer* pTimer){}; |
27 | 27 |
28 CJS_Timer* BeginTimer(CPDFDoc_Envir
onment * pApp, FX_UINT nElapse); | 28 CJS_Timer* BeginTimer(CPDFDoc_Envir
onment * pApp, FX_UINT nElapse); |
29 void EndTimer(CJS_Timer* pTim
er); | 29 void EndTimer(CJS_Timer* pTim
er); |
30 | 30 |
31 CJS_Object* GetJSObject(){return m_p
JSObject;}; | 31 CJS_Object* GetJSObject(){return m_p
JSObject;}; |
32 operator CJS_Object* (){return m_
pJSObject;}; | 32 operator CJS_Object* (){return m_
pJSObject;}; |
33 | 33 |
34 CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc)
; | 34 CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc)
; |
35 » int» » » » » » » MsgBox(CPDFDoc_E
nvironment* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTi
tle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0); | 35 » int» » » » » » » MsgBox(CPDFDoc_E
nvironment* pApp, CPDFSDK_PageView* pPageView, const FX_WCHAR* swMsg, const FX_W
CHAR* swTitle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0); |
36 » void» » » » » » Alert(CJS_Context* pCont
ext, FX_LPCWSTR swMsg); | 36 » void» » » » » » Alert(CJS_Context* pCont
ext, const FX_WCHAR* swMsg); |
37 | 37 |
38 protected: | 38 protected: |
39 CJS_Object* m_pJSObject; | 39 CJS_Object* m_pJSObject; |
40 }; | 40 }; |
41 | 41 |
42 class CJS_Object | 42 class CJS_Object |
43 { | 43 { |
44 public: | 44 public: |
45 CJS_Object(JSFXObject pObject); | 45 CJS_Object(JSFXObject pObject); |
46 virtual ~CJS_Object(void); | 46 virtual ~CJS_Object(void); |
47 | 47 |
48 void MakeWeak(); | 48 void MakeWeak(); |
49 void Dispose(); | 49 void Dispose(); |
50 | 50 |
51 » virtual FX_BOOL»» » » IsType(FX_LPCSTR sClassName){ret
urn TRUE;}; | 51 » virtual FX_BOOL»» » » IsType(const FX_CHAR* sClassName
){return TRUE;}; |
52 virtual CFX_ByteString GetClassName(){return "";}; | 52 virtual CFX_ByteString GetClassName(){return "";}; |
53 | 53 |
54 virtual FX_BOOL InitInstance(IFXJS_Context* cc){
return TRUE;}; | 54 virtual FX_BOOL InitInstance(IFXJS_Context* cc){
return TRUE;}; |
55 virtual FX_BOOL ExitInstance(){return TRUE;}; | 55 virtual FX_BOOL ExitInstance(){return TRUE;}; |
56 | 56 |
57 operator JSFXObject () {return v8
::Local<v8::Object>::New(m_pIsolate, m_pObject);} | 57 operator JSFXObject () {return v8
::Local<v8::Object>::New(m_pIsolate, m_pObject);} |
58 operator CJS_EmbedObj* (){return
m_pEmbedObj;}; | 58 operator CJS_EmbedObj* (){return
m_pEmbedObj;}; |
59 | 59 |
60 void SetEmbedObject(CJS_Embed
Obj* pObj){m_pEmbedObj = pObj;}; | 60 void SetEmbedObject(CJS_Embed
Obj* pObj){m_pEmbedObj = pObj;}; |
61 CJS_EmbedObj * GetEmbedObject(){return m_pEmbed
Obj;}; | 61 CJS_EmbedObj * GetEmbedObject(){return m_pEmbed
Obj;}; |
62 | 62 |
63 static CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc); | 63 static CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc); |
64 » static int» » » » » MsgBox(CPDFDoc_Environme
nt* pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = NU
LL, FX_UINT nType = 0,FX_UINT nIcon = 0); | 64 » static int» » » » » MsgBox(CPDFDoc_Environme
nt* pApp, CPDFSDK_PageView* pPageView, const FX_WCHAR* swMsg, const FX_WCHAR* sw
Title = NULL, FX_UINT nType = 0,FX_UINT nIcon = 0); |
65 » static void» » » » » Alert(CJS_Context* pCont
ext, FX_LPCWSTR swMsg); | 65 » static void» » » » » Alert(CJS_Context* pCont
ext, const FX_WCHAR* swMsg); |
66 | 66 |
67 v8::Isolate* GetIsolate() {return m_p
Isolate;} | 67 v8::Isolate* GetIsolate() {return m_p
Isolate;} |
68 protected: | 68 protected: |
69 CJS_EmbedObj * m_pEmbedObj; | 69 CJS_EmbedObj * m_pEmbedObj; |
70 v8::Global<v8::Object> m_pObject; | 70 v8::Global<v8::Object> m_pObject; |
71 v8::Isolate* m_pIsolate; | 71 v8::Isolate* m_pIsolate; |
72 }; | 72 }; |
73 | 73 |
74 struct JS_TIMER_MAP | 74 struct JS_TIMER_MAP |
75 { | 75 { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 FX_DWORD m_dwTime
Out; | 286 FX_DWORD m_dwTime
Out; |
287 FX_DWORD m_dwElapse; | 287 FX_DWORD m_dwElapse; |
288 CJS_Runtime* m_pRuntime; | 288 CJS_Runtime* m_pRuntime; |
289 CFX_WideString m_swJScript; | 289 CFX_WideString m_swJScript; |
290 int m_nType;
//0:Interval; 1:TimeOut | 290 int m_nType;
//0:Interval; 1:TimeOut |
291 | 291 |
292 CPDFDoc_Environment* m_pApp; | 292 CPDFDoc_Environment* m_pApp; |
293 }; | 293 }; |
294 | 294 |
295 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ | 295 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ |
OLD | NEW |