From 9242a80a84fa5c96dbadec9594177875aeeec1ac Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 10 Jul 2012 18:37:21 +0000 Subject: only added MyDetails and Skins. not adopted yet git-svn-id: http://svn.miranda-ng.org/main/trunk@892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp | 160 +++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp (limited to 'plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp') diff --git a/plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp b/plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp new file mode 100644 index 0000000000..71cc057419 --- /dev/null +++ b/plugins/Skins/SkinLib/BorderState_v8_wrapper.cpp @@ -0,0 +1,160 @@ +#include "globals.h" +#include "BorderState_v8_wrapper.h" +#include +#include "BorderState.h" + +using namespace v8; + + +#ifdef UNICODE +# define V8_TCHAR uint16_t +#else +# define V8_TCHAR char +#endif + + +static Handle Get_BorderState_left(Local property, const AccessorInfo &info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return scope.Close( Undefined() ); + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return scope.Close( Undefined() ); + + return scope.Close( Int32::New(tmp->getLeft()) ); +} + +static void Set_BorderState_left(Local property, Local value, const AccessorInfo& info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return; + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return; + + if (!value.IsEmpty() && value->IsNumber()) + tmp->setLeft(value->Int32Value()); +} + + +static Handle Get_BorderState_right(Local property, const AccessorInfo &info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return scope.Close( Undefined() ); + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return scope.Close( Undefined() ); + + return scope.Close( Int32::New(tmp->getRight()) ); +} + +static void Set_BorderState_right(Local property, Local value, const AccessorInfo& info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return; + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return; + + if (!value.IsEmpty() && value->IsNumber()) + tmp->setRight(value->Int32Value()); +} + + +static Handle Get_BorderState_top(Local property, const AccessorInfo &info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return scope.Close( Undefined() ); + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return scope.Close( Undefined() ); + + return scope.Close( Int32::New(tmp->getTop()) ); +} + +static void Set_BorderState_top(Local property, Local value, const AccessorInfo& info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return; + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return; + + if (!value.IsEmpty() && value->IsNumber()) + tmp->setTop(value->Int32Value()); +} + + +static Handle Get_BorderState_bottom(Local property, const AccessorInfo &info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return scope.Close( Undefined() ); + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return scope.Close( Undefined() ); + + return scope.Close( Int32::New(tmp->getBottom()) ); +} + +static void Set_BorderState_bottom(Local property, Local value, const AccessorInfo& info) +{ + HandleScope scope; + + Local self = info.Holder(); + Local wrap = Local::Cast(self->GetInternalField(0)); + if (wrap.IsEmpty()) + return; + + BorderState *tmp = (BorderState *) wrap->Value(); + if (tmp == NULL) + return; + + if (!value.IsEmpty() && value->IsNumber()) + tmp->setBottom(value->Int32Value()); +} + + +void AddBorderStateAcessors(Handle &templ) +{ + HandleScope scope; + + templ->SetAccessor(String::New("left"), Get_BorderState_left, Set_BorderState_left); + templ->SetAccessor(String::New("right"), Get_BorderState_right, Set_BorderState_right); + templ->SetAccessor(String::New("top"), Get_BorderState_top, Set_BorderState_top); + templ->SetAccessor(String::New("bottom"), Get_BorderState_bottom, Set_BorderState_bottom); +} -- cgit v1.2.3