summaryrefslogtreecommitdiff
path: root/Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-06 05:45:37 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-06 05:45:37 +0000
commit3abd781670e4cd7a82d5ab2966ef9f8131535b54 (patch)
tree85cc3fcad80d491c706d77ed7a399cc17349dc6f /Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp
parent30f9565911217d38cefda3920f55d183d8f6e219 (diff)
skins:
Added border to fields State is now got through interface It works! git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@124 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp')
-rw-r--r--Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp126
1 files changed, 124 insertions, 2 deletions
diff --git a/Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp b/Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp
index 23f5d36..c1c49e3 100644
--- a/Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp
+++ b/Plugins/skins/SkinLib/DialogState_v8_wrapper.cpp
@@ -17,7 +17,13 @@ static Handle<Value> Get_DialogState_width(Local<String> property, const Accesso
{
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
return Int32::New(tmp->getWidth());
}
@@ -25,8 +31,15 @@ static void Set_DialogState_width(Local<String> property, Local<Value> value, co
{
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return;
+
DialogState *tmp = (DialogState *) wrap->Value();
- tmp->setWidth(value->Int32Value());
+ if (tmp == NULL)
+ return;
+
+ if (!value.IsEmpty() && value->IsInt32())
+ tmp->setWidth(value->Int32Value());
}
@@ -34,7 +47,13 @@ static Handle<Value> Get_DialogState_height(Local<String> property, const Access
{
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
return Int32::New(tmp->getHeight());
}
@@ -42,8 +61,105 @@ static void Set_DialogState_height(Local<String> property, Local<Value> value, c
{
Local<Object> self = info.Holder();
Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return;
+
+ DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return;
+
+ if (!value.IsEmpty() && value->IsInt32())
+ tmp->setHeight(value->Int32Value());
+}
+
+
+static Handle<Value> Get_DialogState_x(Local<String> property, const AccessorInfo &info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
+ DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
+ return Int32::New(tmp->getX());
+}
+
+
+static Handle<Value> Get_DialogState_y(Local<String> property, const AccessorInfo &info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
+ DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
+ return Int32::New(tmp->getY());
+}
+
+
+static Handle<Value> Get_DialogState_left(Local<String> property, const AccessorInfo &info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
+ DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
+ return Int32::New(tmp->getLeft());
+}
+
+
+static Handle<Value> Get_DialogState_top(Local<String> property, const AccessorInfo &info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
DialogState *tmp = (DialogState *) wrap->Value();
- tmp->setHeight(value->Int32Value());
+ if (tmp == NULL)
+ return Undefined();
+
+ return Int32::New(tmp->getTop());
+}
+
+
+static Handle<Value> Get_DialogState_right(Local<String> property, const AccessorInfo &info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
+ DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
+ return Int32::New(tmp->getRight());
+}
+
+
+static Handle<Value> Get_DialogState_bottom(Local<String> property, const AccessorInfo &info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return Undefined();
+
+ DialogState *tmp = (DialogState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
+ return Int32::New(tmp->getBottom());
}
@@ -51,4 +167,10 @@ 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);
+ templ->SetAccessor(String::New("x"), Get_DialogState_x, NULL, Handle<Value>(), DEFAULT, ReadOnly);
+ templ->SetAccessor(String::New("y"), Get_DialogState_y, NULL, Handle<Value>(), DEFAULT, ReadOnly);
+ templ->SetAccessor(String::New("left"), Get_DialogState_left, NULL, Handle<Value>(), DEFAULT, ReadOnly);
+ templ->SetAccessor(String::New("top"), Get_DialogState_top, NULL, Handle<Value>(), DEFAULT, ReadOnly);
+ templ->SetAccessor(String::New("right"), Get_DialogState_right, NULL, Handle<Value>(), DEFAULT, ReadOnly);
+ templ->SetAccessor(String::New("bottom"), Get_DialogState_bottom, NULL, Handle<Value>(), DEFAULT, ReadOnly);
}