forked from DLive/npSafeInput
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScriptablePluginObject.cpp
executable file
·72 lines (58 loc) · 1.52 KB
/
ScriptablePluginObject.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "StdAfx.h"
#include "ScriptablePluginObject.h"
//#include "ConstructablePluginObject.h"
#include "Plugin.h"
bool
ScriptablePluginObject::HasMethod(NPIdentifier name)
{
OutputDebugStringA("obj_hasmethod");
if(name=mcreateinput_id)
return true;
return false;
}
bool
ScriptablePluginObject::HasProperty(NPIdentifier name)
{
OutputDebugStringA("obj_hasproperty");
return false;
}
bool ScriptablePluginObject::SetProperty(NPIdentifier name,
const NPVariant *value)
{
OutputDebugStringA("base_setproperty");
return false;
}
bool
ScriptablePluginObject::GetProperty(NPIdentifier name, NPVariant *result)
{
OutputDebugStringA("obj_getproperty");
VOID_TO_NPVARIANT(*result);
return false;
}
bool
ScriptablePluginObject::Invoke(NPIdentifier name, const NPVariant *args,
uint32_t argCount, NPVariant *result)
{
OutputDebugStringA("obj_invoke");
CPlugin *plugin=(CPlugin*)mNpp->pdata;
if(name==mcreateinput_id)
{
plugin->createInput();
return true;
}
return false;
}
bool
ScriptablePluginObject::InvokeDefault(const NPVariant *args, uint32_t argCount,
NPVariant *result)
{
OutputDebugStringA("obj_InvokeDefault");
printf ("ScriptablePluginObject default method called!\n");
const char* outString = "default method return val";
char* npOutString = (char *)NPN_MemAlloc(strlen(outString) + 1);
if (!npOutString)
return false;
strcpy(npOutString, outString);
STRINGZ_TO_NPVARIANT(npOutString, *result);
return true;
}