diff options
author | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-06 05:45:37 +0000 |
---|---|---|
committer | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-06 05:45:37 +0000 |
commit | 3abd781670e4cd7a82d5ab2966ef9f8131535b54 (patch) | |
tree | 85cc3fcad80d491c706d77ed7a399cc17349dc6f /Plugins/skins/SkinLib/V8Script.cpp | |
parent | 30f9565911217d38cefda3920f55d183d8f6e219 (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/V8Script.cpp')
-rw-r--r-- | Plugins/skins/SkinLib/V8Script.cpp | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/Plugins/skins/SkinLib/V8Script.cpp b/Plugins/skins/SkinLib/V8Script.cpp index 2df8cad..0d0fc85 100644 --- a/Plugins/skins/SkinLib/V8Script.cpp +++ b/Plugins/skins/SkinLib/V8Script.cpp @@ -31,10 +31,17 @@ static Handle<Value> IsEmptyCallback(const Arguments& args) {
return Boolean::New(true);
}
- else if (arg->IsExternal())
+ else if (arg->IsObject())
{
- Local<External> wrap = Local<External>::Cast(arg);
+ Local<Object> self = Local<Object>::Cast(arg);
+ if (self->InternalFieldCount() < 1)
+ continue;
+
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
FieldState *field = (FieldState *) wrap->Value();
+ if (field == NULL)
+ continue;
+
if (field->isEmpty())
return Boolean::New(true);
}
@@ -58,6 +65,34 @@ static Handle<Value> RGBCallback(const Arguments& args) return Int32::New(color);
}
+static Handle<Value> AlertCallback(const Arguments& args)
+{
+ Local<External> wrap = Local<External>::Cast(args.Data());
+ if (wrap.IsEmpty())
+ return Int32::New(-1);
+
+ Dialog *dialog = (Dialog *) wrap->Value();
+ if (dialog == NULL)
+ return Int32::New(-1);
+
+ if (args.Length() < 1)
+ return Int32::New(-1);
+
+ Local<Value> arg = args[0];
+ if (!arg->IsString())
+ return Int32::New(-1);
+
+ Local<String> str = Local<String>::Cast(arg);
+ String::Utf8Value utf8_value(str);
+
+ std::tstring title;
+ title = CharToTchar(dialog->getName());
+ title += _T(" - Skin alert");
+ MessageBox(NULL, Utf8ToTchar(*utf8_value), title.c_str(), MB_OK);
+
+ return Int32::New(0);
+}
+
bool V8Script::compile(const TCHAR *source, Dialog *dlg)
{
dispose();
@@ -68,6 +103,7 @@ bool V8Script::compile(const TCHAR *source, Dialog *dlg) global->Set(String::New("IsEmpty"), FunctionTemplate::New(&IsEmptyCallback));
global->Set(String::New("RGB"), FunctionTemplate::New(&RGBCallback));
+ global->Set(String::New("alert"), FunctionTemplate::New(&AlertCallback, External::New(dlg)));
global->Set(String::New("NUMBER"), String::New("NUMBER"));
global->Set(String::New("CHECKBOX"), String::New("CHECKBOX"));
|