summaryrefslogtreecommitdiff
path: root/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp
diff options
context:
space:
mode:
authorpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-20 02:18:30 +0000
committerpescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7>2009-01-20 02:18:30 +0000
commitff634d35c1fbd2831be6c1206bb9298cd5a14eda (patch)
tree4442b38df9af9721e73300e9235f868d4adf4261 /Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp
parent283ebdc88fe0867c50f56306bf53dcdeec0da013 (diff)
skins:
* Updated v8 + Added tooltips git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@127 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp')
-rw-r--r--Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp b/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp
index 7217a2e..a4213b1 100644
--- a/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp
+++ b/Plugins/skins/SkinLib/FieldState_v8_wrapper.cpp
@@ -2,6 +2,7 @@
#include "FieldState_v8_wrapper.h"
#include <v8.h>
#include "FieldState.h"
+#include <utf8_helpers.h>
using namespace v8;
@@ -298,6 +299,39 @@ static Handle<Value> Get_FieldState_enabled(Local<String> property, const Access
}
+static Handle<Value> Get_FieldState_toolTip(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();
+
+ FieldState *tmp = (FieldState *) wrap->Value();
+ if (tmp == NULL)
+ return Undefined();
+
+ return String::New((const V8_TCHAR *) tmp->getToolTip());
+}
+
+static void Set_FieldState_toolTip(Local<String> property, Local<Value> value, const AccessorInfo& info)
+{
+ Local<Object> self = info.Holder();
+ Local<External> wrap = Local<External>::Cast(self->GetInternalField(0));
+ if (wrap.IsEmpty())
+ return;
+
+ FieldState *tmp = (FieldState *) wrap->Value();
+ if (tmp == NULL)
+ return;
+
+ if (!value.IsEmpty() && value->IsString())
+ {
+ String::Utf8Value utf8_value(value);
+ tmp->setToolTip(Utf8ToTchar(*utf8_value));
+ }
+}
+
+
void AddFieldStateAcessors(Handle<ObjectTemplate> &templ)
{
templ->SetAccessor(String::New("x"), Get_FieldState_x, Set_FieldState_x);
@@ -310,4 +344,5 @@ void AddFieldStateAcessors(Handle<ObjectTemplate> &templ)
templ->SetAccessor(String::New("bottom"), Get_FieldState_bottom, Set_FieldState_bottom);
templ->SetAccessor(String::New("visible"), Get_FieldState_visible, Set_FieldState_visible);
templ->SetAccessor(String::New("enabled"), Get_FieldState_enabled, NULL, Handle<Value>(), DEFAULT, ReadOnly);
+ templ->SetAccessor(String::New("toolTip"), Get_FieldState_toolTip, Set_FieldState_toolTip);
}