#include "globals.h" #include "DialogState_v8_wrapper.h" #include #include "DialogState.h" using namespace v8; #ifdef UNICODE # define V8_TCHAR uint16_t #else # define V8_TCHAR char #endif static Handle Get_DialogState_width(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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getWidth()) ); } static void Set_DialogState_width(Local property, Local value, const AccessorInfo& info) { HandleScope scope; Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) return; DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return; if (!value.IsEmpty() && value->IsNumber()) tmp->setWidth(value->Int32Value()); } static Handle Get_DialogState_height(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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getHeight()) ); } static void Set_DialogState_height(Local property, Local value, const AccessorInfo& info) { HandleScope scope; Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) return; DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return; if (!value.IsEmpty() && value->IsNumber()) tmp->setHeight(value->Int32Value()); } static Handle Get_DialogState_x(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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getX()) ); } static Handle Get_DialogState_y(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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getY()) ); } static Handle Get_DialogState_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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getLeft()) ); } static Handle Get_DialogState_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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getTop()) ); } static Handle Get_DialogState_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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getRight()) ); } static Handle Get_DialogState_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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( Int32::New(tmp->getBottom()) ); } static Handle Get_DialogState_borders(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() ); DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return scope.Close( Undefined() ); return scope.Close( self->Get(String::New("bordersRaw")) ); } static void Set_DialogState_borders(Local property, Local value, const AccessorInfo& info) { HandleScope scope; Local self = info.Holder(); Local wrap = Local::Cast(self->GetInternalField(0)); if (wrap.IsEmpty()) return; DialogState *tmp = (DialogState *) wrap->Value(); if (tmp == NULL) return; if (!value.IsEmpty() && value->IsInt32()) tmp->getBorders()->setAll(value->Int32Value()); } void AddDialogStateAcessors(Handle &templ) { HandleScope scope; templ->SetAccessor(String::New("width"), Get_DialogState_width, Set_DialogState_width); templ->SetAccessor(String::New("height"), Get_DialogState_height, Set_DialogState_height); templ->SetAccessor(String::New("x"), Get_DialogState_x, NULL, Handle(), DEFAULT, ReadOnly); templ->SetAccessor(String::New("y"), Get_DialogState_y, NULL, Handle(), DEFAULT, ReadOnly); templ->SetAccessor(String::New("left"), Get_DialogState_left, NULL, Handle(), DEFAULT, ReadOnly); templ->SetAccessor(String::New("top"), Get_DialogState_top, NULL, Handle(), DEFAULT, ReadOnly); templ->SetAccessor(String::New("right"), Get_DialogState_right, NULL, Handle(), DEFAULT, ReadOnly); templ->SetAccessor(String::New("bottom"), Get_DialogState_bottom, NULL, Handle(), DEFAULT, ReadOnly); templ->SetAccessor(String::New("borders"), Get_DialogState_borders, Set_DialogState_borders); }