summaryrefslogtreecommitdiff
path: root/Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp
blob: 23f5d36f986a9b3c9b0cd4d610bf8728a770c678 (plain)
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
#include "globals.h"
#include "DialogState_v8_wrapper.h"
#include <v8.h>
#include "DialogState.h"

using namespace v8;


#ifdef UNICODE
# define V8_TCHAR uint16_t
#else
# define V8_TCHAR char
#endif


static Handle<Value> Get_DialogState_width(Local<String> property, const AccessorInfo &info) 
{
	Local<Object> self = info.Holder();
	Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
	DialogState *tmp = (DialogState *) wrap->Value();
	return Int32::New(tmp->getWidth());
}

static void Set_DialogState_width(Local<String> property, Local<Value> value, const AccessorInfo& info) 
{
	Local<Object> self = info.Holder();
	Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
	DialogState *tmp = (DialogState *) wrap->Value();
	tmp->setWidth(value->Int32Value());
}


static Handle<Value> Get_DialogState_height(Local<String> property, const AccessorInfo &info) 
{
	Local<Object> self = info.Holder();
	Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
	DialogState *tmp = (DialogState *) wrap->Value();
	return Int32::New(tmp->getHeight());
}

static void Set_DialogState_height(Local<String> property, Local<Value> value, const AccessorInfo& info) 
{
	Local<Object> self = info.Holder();
	Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
	DialogState *tmp = (DialogState *) wrap->Value();
	tmp->setHeight(value->Int32Value());
}


void AddDialogStateAcessors(Handle<ObjectTemplate> &templ)
{
	templ->SetAccessor(String::New("width"), Get_DialogState_width, Set_DialogState_width);
	templ->SetAccessor(String::New("height"), Get_DialogState_height, Set_DialogState_height);
}