diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-10 18:37:21 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-10 18:37:21 +0000 |
commit | 9242a80a84fa5c96dbadec9594177875aeeec1ac (patch) | |
tree | 05140dc253f5c73bc5a96624ffed8d1eff9a48e7 /plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp | |
parent | 6f8361aaf17045ff81149eeb22ed0a15b4d4ad94 (diff) |
only added MyDetails and Skins. not adopted yet
git-svn-id: http://svn.miranda-ng.org/main/trunk@892 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp')
-rw-r--r-- | plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp b/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp new file mode 100644 index 0000000000..70d3e06a45 --- /dev/null +++ b/plugins/Skins/SkinLib/ControlFieldState_v8_wrapper.cpp @@ -0,0 +1,59 @@ +#include "globals.h"
+#include "ControlFieldState_v8_wrapper.h"
+#include <v8.h>
+#include "ControlFieldState.h"
+#include <utf8_helpers.h>
+
+using namespace v8;
+
+
+#ifdef UNICODE
+# define V8_TCHAR uint16_t
+#else
+# define V8_TCHAR char
+#endif
+
+
+static Handle<Value> Get_ControlFieldState_text(Local<String> property, const AccessorInfo &info)
+{
+ HandleScope scope;
+
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return scope.Close( Undefined() );
+
+ ControlFieldState *tmp = (ControlFieldState *) wrap->Value();
+ if (tmp == NULL)
+ return scope.Close( Undefined() );
+
+ return scope.Close( String::New((const V8_TCHAR *) tmp->getText()) );
+}
+
+static void Set_ControlFieldState_text(Local<String> property, Local<Value> value, const AccessorInfo& info)
+{
+ HandleScope scope;
+
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return;
+
+ ControlFieldState *tmp = (ControlFieldState *) wrap->Value();
+ if (tmp == NULL)
+ return;
+
+ if (!value.IsEmpty() && value->IsString())
+ {
+ String::Utf8Value utf8_value(value);
+ tmp->setText(Utf8ToTchar(*utf8_value));
+ }
+}
+
+
+void AddControlFieldStateAcessors(Handle<ObjectTemplate> &templ)
+{
+ HandleScope scope;
+
+ templ->SetAccessor(String::New("text"), Get_ControlFieldState_text, Set_ControlFieldState_text);
+}
|