diff options
author | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-20 23:24:30 +0000 |
---|---|---|
committer | pescuma <pescuma@c086bb3d-8645-0410-b8da-73a8550f86e7> | 2009-01-20 23:24:30 +0000 |
commit | 334bfbad3fda3860f51b74cd6370786ef253ad49 (patch) | |
tree | 2cc40bf67b0ad86fc1e8c2e5f0a2e2085498ae7b /Plugins/skins/SkinLib/TextFieldState_v8_wrapper.cpp | |
parent | ff634d35c1fbd2831be6c1206bb9298cd5a14eda (diff) |
skins: templates are kept in memory
git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@128 c086bb3d-8645-0410-b8da-73a8550f86e7
Diffstat (limited to 'Plugins/skins/SkinLib/TextFieldState_v8_wrapper.cpp')
-rw-r--r-- | Plugins/skins/SkinLib/TextFieldState_v8_wrapper.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/Plugins/skins/SkinLib/TextFieldState_v8_wrapper.cpp b/Plugins/skins/SkinLib/TextFieldState_v8_wrapper.cpp index 73035d9..6eb4a39 100644 --- a/Plugins/skins/SkinLib/TextFieldState_v8_wrapper.cpp +++ b/Plugins/skins/SkinLib/TextFieldState_v8_wrapper.cpp @@ -16,20 +16,24 @@ using namespace v8; static Handle<Value> Get_TextFieldState_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 Undefined();
+ return scope.Close( Undefined() );
TextFieldState *tmp = (TextFieldState *) wrap->Value();
if (tmp == NULL)
- return Undefined();
+ return scope.Close( Undefined() );
- return String::New((const V8_TCHAR *) tmp->getText());
+ return scope.Close( String::New((const V8_TCHAR *) tmp->getText()) );
}
static void Set_TextFieldState_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())
@@ -49,26 +53,30 @@ static void Set_TextFieldState_text(Local<String> property, Local<Value> value, static Handle<Value> Get_TextFieldState_hAlign(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 Undefined();
+ return scope.Close( Undefined() );
TextFieldState *tmp = (TextFieldState *) wrap->Value();
if (tmp == NULL)
- return Undefined();
+ return scope.Close( Undefined() );
switch(tmp->getHAlign())
{
- case LEFT: return String::New((const V8_TCHAR *) _T("LEFT"));
- case CENTER: return String::New((const V8_TCHAR *) _T("CENTER"));
- case RIGHT: return String::New((const V8_TCHAR *) _T("RIGHT"));
+ case LEFT: return scope.Close( String::New((const V8_TCHAR *) _T("LEFT")) );
+ case CENTER: return scope.Close( String::New((const V8_TCHAR *) _T("CENTER")) );
+ case RIGHT: return scope.Close( String::New((const V8_TCHAR *) _T("RIGHT")) );
}
- return Undefined();
+ return scope.Close( Undefined() );
}
static void Set_TextFieldState_hAlign(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())
@@ -94,6 +102,8 @@ static void Set_TextFieldState_hAlign(Local<String> property, Local<Value> value void AddTextFieldStateAcessors(Handle<ObjectTemplate> &templ)
{
+ HandleScope scope;
+
templ->SetAccessor(String::New("text"), Get_TextFieldState_text, Set_TextFieldState_text);
templ->SetAccessor(String::New("hAlign"), Get_TextFieldState_hAlign, Set_TextFieldState_hAlign);
}
|