v8::Handle<v8::Value> Texture::handleGenerate(const v8::Arguments& args) { v8::HandleScope scope; v8::Local<v8::Object> thisObj = args.This(); if (thisObj.IsEmpty()) { return scope.Close(v8::Null()); } v8::Local<v8::String> property = v8::String::New("id"); if (thisObj->Has(property)) { int width = thisObj->Get(v8::String::New("width"))->IntegerValue(); int height = thisObj->Get(v8::String::New("height"))->IntegerValue(); GLvoid* data = thisObj->GetPointerFromInternalField(0); GLuint id = api::Texture::generate(width, height, data); // Not read-only to allow re-generation of Textures in different glut windows. thisObj->Set(property, v8::Integer::New(id)); } return scope.Close(v8::Null()); }
/*static*/ v8::Handle<v8::Value> wxNode_wxSizerFlags::_Align(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxSizerFlags* self = unwrap<wxNode_wxSizerFlags>(args.This()); /* * id: _40884 */ if(args.Length() == 1 && args[0]->IsNumber()) { int alignment = (int)args[0]->ToInt32()->Value(); /* type: _165 */ wxSizerFlags returnVal = self->Align(alignment); return scope.Close(wxNode_wxSizerFlags::NewCopy(returnVal)); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxSizerFlags::Align).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
v8::Handle<v8::Value> JOpenGL::glGetString(const v8::Arguments& args) { METHOD_BEGIN(1); //const GLubyte * glGetString (GLenum name) //TODO: Enter code here return args.This(); METHOD_END(); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_Attach(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39764 */ if(args.Length() == 1 && (args[0]->IsNull() || (args[0]->IsObject() && wxNode_wxFrame::AssignableFrom(args[0]->ToObject()->GetConstructorName())))) { wxNode_wxFrame* frame = args[0]->IsNull() ? NULL : wxNodeObject::unwrap<wxNode_wxFrame>(args[0]->ToObject()); /* type: _32795 * */ self->Attach(frame); return v8::Undefined(); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::Attach).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
/*static*/ v8::Handle<v8::Value> wxNode_wxStaticText::_IsEllipsized(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxStaticText* self = unwrap<wxNode_wxStaticText>(args.This()); /* * id: _50286 */ if(args.Length() == 0) { bool returnVal = self->IsEllipsized(); return scope.Close(v8::Boolean::New(returnVal)); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxStaticText::IsEllipsized).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_FindMenu(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39752 */ if(args.Length() == 1 && args[0]->IsString()) { v8::String::AsciiValue title(args[0]->ToString()); /* type: _14975 */ int returnVal = self->FindMenu(*title); return scope.Close(v8::Number::New(returnVal)); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::FindMenu).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_GetHelpString(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39761 */ if(args.Length() == 1 && args[0]->IsNumber()) { int itemid = (int)args[0]->ToInt32()->Value(); /* type: _165 */ wxString returnVal = self->GetHelpString(itemid); return scope.Close(v8::String::New(returnVal.mb_str())); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::GetHelpString).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
v8::Handle<v8::Value> v8Image::New(const v8::Arguments &args) { HandleScope scope; try { Image *image = NULL; if (args.Length() > 0) { int width, height; if (args[0]->IsArray()) { width = args[0].As<Array>()->Get(0)->Int32Value(); height = args[0].As<Array>()->Get(1)->Int32Value(); } else { width = args[0]->Uint32Value(); height = args[1]->Uint32Value(); } image = Image::factoryManager.instance()->create(width, height); } new v8Image(args.Holder(), image); } catch (FactoryManager<Image>::factory_instance_error &e) { return ThrowException(v8::Exception::ReferenceError(String::NewSymbol( e.what() ))); } return args.This(); }
v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args) { if (ConstructorMode::current() == ConstructorMode::CreateNewObject) return throwError(TypeError, "Illegal constructor", args.GetIsolate()); return args.This(); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_layout_at (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QLayout *layout = self->v8_to_qobject<QLayout> (Args.This ()); if (layout) { if (Args.Length () > 0) { QWidget *widget = layout->itemAt (v8_to_int32 (Args[0]))->widget (); if (widget) { result = self->create_v8_qwidget (widget); } } } } return scope.Close (result); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_form_layout_spacing (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QFormLayout *form = self->v8_to_qobject<QFormLayout> (Args.This ()); if (form) { if (Args.Length () == 0) { result = v8::Number::New (form->spacing ()); } else if (Args.Length () == 1) { form->setSpacing (v8_to_int32 (Args[0])); } } } return scope.Close (result); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_grid_layout_row_stretch (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QGridLayout *grid = self->v8_to_qobject<QGridLayout> (Args.This ()); if (grid) { if (Args.Length () > 1) { int row = v8_to_int32 (Args[0]); int stretch = v8_to_int32 (Args[1]); grid->setColumnStretch (row, stretch); } else if (Args.Length () == 1) { result = v8::Number::New (grid->rowStretch (v8_to_int32 (Args[0]))); } } } return scope.Close (result); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_box_layout_direction (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QBoxLayout *layout = self->v8_to_qobject<QBoxLayout> (Args.This ()); if (layout) { if (Args.Length () > 0) { int direction = v8_to_int32 (Args[0]); if ((direction < 0) || (direction > 3)) { direction = 0; } layout->setDirection ((QBoxLayout::Direction)direction); } } } return scope.Close (result); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_box_layout_add_layout (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QBoxLayout *layout = self->v8_to_qobject<QBoxLayout> (Args.This ()); if (layout) { if (Args.Length () > 0) { QLayout *newLayout = self->v8_to_qobject<QLayout> (Args[0]); if (newLayout) { layout->addLayout (newLayout); } } } } return scope.Close (result); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_IsEnabledTop(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39746 */ if(args.Length() == 1 && args[0]->IsNumber()) { unsigned int arg0 = (unsigned int)args[0]->ToInt32()->Value(); /* type: _8711 */ bool returnVal = self->IsEnabledTop(arg0); return scope.Close(v8::Boolean::New(returnVal)); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::IsEnabledTop).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
v8::Handle<v8::Value> Window::SetBounds(const v8::Arguments & args) { v8::HandleScope scope; util::check_argument_count(args, 4); double left; if (!util::read_arg_double(args, 0, &left)) { return v8::Undefined(); } double top; if (!util::read_arg_double(args, 1, &top)) { return v8::Undefined(); } double right; if (!util::read_arg_double(args, 2, &right)) { return v8::Undefined(); } double bottom; if (!util::read_arg_double(args, 3, &bottom)) { return v8::Undefined(); } Window * window = ObjectWrap::Unwrap<Window>(args.This()); // bool ret = window->m_window->setBounds(); bool ret = s_dispatcher->send<ui::traits::RectF, ui::traits::Boolean>( ui::RectF((ui::CoordF)left, (ui::CoordF)top, (ui::CoordF)right, (ui::CoordF)bottom), ino::make_delegate(window->m_window.get(), &ui::Wnd::setBounds) ); return scope.Close(v8::Boolean::New(ret)); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_SetMenuLabel(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39747 */ if(args.Length() == 2 && args[0]->IsNumber() && args[1]->IsString()) { unsigned int pos = (unsigned int)args[0]->ToInt32()->Value(); /* type: _8711 */ v8::String::AsciiValue label(args[1]->ToString()); /* type: _14975 */ self->SetMenuLabel(pos, *label); return v8::Undefined(); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::SetMenuLabel).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
Handle<Value> ConstructCO(const v8::Arguments& args) { Handle<External> ext = Handle<External>::Cast(args[0]); dtEntity::Component* co = static_cast<dtEntity::Component*>(ext->Value()); args.This()->SetInternalField(0, External::New(co)); return Undefined(); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_Check(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39754 */ if(args.Length() == 2 && args[0]->IsNumber() && args[1]->IsBoolean()) { int itemid = (int)args[0]->ToInt32()->Value(); /* type: _165 */ bool check = args[1]->ToBoolean()->Value(); /* type: _14830 */ self->Check(itemid, check); return v8::Undefined(); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::Check).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
/*static*/ v8::Handle<v8::Value> NodeWxApp::_setTopWindow(const v8::Arguments& args) { NodeWxApp *self = unwrap<NodeWxApp>(args.This()); v8::Local<v8::Object> windowObj = args[0]->ToObject(); wxFrame* wnd = wxNodeObject::unwrap<wxFrame>(windowObj); self->SetTopWindow(wnd); return v8::Undefined(); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_GetFrame(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39762 */ if(args.Length() == 0) { wxFrame* returnVal = self->GetFrame(); return scope.Close(wxNode_wxFrame::New(returnVal)); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::GetFrame).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_list_widget_find_items (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QListWidget *table = self->v8_to_qobject<QListWidget> (Args.This ()); if (table) { if (Args.Length ()) { QString str (v8_to_qstring (Args[0])); Qt::MatchFlags flag = Qt::MatchExactly; if (Args.Length () > 1) { flag = (Qt::MatchFlags)v8_to_uint32 (Args[1]); } QList<QListWidgetItem *> items = table->findItems (str, flag); const int Length = items.count (); V8Array array = v8::Array::New (Length); for (int ix = 0; ix < Length; ++ix) { V8Value value = self->create_v8_qlistwidgetitem (items.at (ix)); array->Set (v8::Integer::New (ix), value); } result = array; } } } return scope.Close (result); }
/*static*/ v8::Handle<v8::Value> wxNode_wxStaticText::_Wrap(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxStaticText* self = unwrap<wxNode_wxStaticText>(args.This()); /* * id: _50283 */ if(args.Length() == 1 && args[0]->IsNumber()) { int width = (int)args[0]->ToInt32()->Value(); /* type: _165 */ self->Wrap(width); return v8::Undefined(); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxStaticText::Wrap).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_list_widget_add_item (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QListWidget *lw = self->v8_to_qobject<QListWidget> (Args.This ()); if (lw) { if (Args.Length ()) { QString param = v8_to_qstring (Args[0]); QListWidgetItem *item = new QListWidgetItem (param, lw); if (Args.Length () >= 2) { QVariant variant = self->_qvariant_wrap_v8 (Args[1]); item->setData (Qt::UserRole, variant); } result = self->create_v8_qlistwidgetitem (item); } } } return scope.Close (result); }
static v8::Handle<v8::Value> qmlsqldatabase_changeVersion(const v8::Arguments& args) { if (args.Length() < 2) return v8::Undefined(); QV8SqlDatabaseResource *r = v8_resource_cast<QV8SqlDatabaseResource>(args.This()); if (!r || r->type != QV8SqlDatabaseResource::Database) V8THROW_REFERENCE("Not a SQLDatabase object"); QV8Engine *engine = r->engine; QSqlDatabase db = r->database; QString from_version = engine->toString(args[0]); QString to_version = engine->toString(args[1]); v8::Handle<v8::Value> callback = args[2]; if (from_version != r->version) V8THROW_SQL(SQLEXCEPTION_VERSION_ERR, QQmlEngine::tr("Version mismatch: expected %1, found %2").arg(from_version).arg(r->version)); v8::Local<v8::Object> instance = databaseData(engine)->queryConstructor->NewInstance(); QV8SqlDatabaseResource *r2 = new QV8SqlDatabaseResource(engine); r2->type = QV8SqlDatabaseResource::Query; r2->database = db; r2->version = r->version; r2->inTransaction = true; instance->SetExternalResource(r2); bool ok = true; if (callback->IsFunction()) { ok = false; db.transaction(); v8::TryCatch tc; v8::Handle<v8::Value> callbackArgs[] = { instance }; v8::Handle<v8::Function>::Cast(callback)->Call(engine->global(), 1, callbackArgs); if (tc.HasCaught()) { db.rollback(); tc.ReThrow(); return v8::Handle<v8::Value>(); } else if (!db.commit()) { db.rollback(); V8THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR,QQmlEngine::tr("SQL transaction failed")); } else { ok = true; } } r2->inTransaction = false; if (ok) { r2->version = to_version; #ifndef QT_NO_SETTINGS QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(),engine) + QLatin1String(".ini"), QSettings::IniFormat); ini.setValue(QLatin1String("Version"), to_version); #endif } return v8::Undefined(); }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_list_widget_take_item (const v8::Arguments &Args) { v8::HandleScope scope; V8Value result = v8::Undefined (); JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QListWidget *lw = self->v8_to_qobject<QListWidget> (Args.This ()); if (lw) { if (Args.Length ()) { QListWidgetItem *item = self->_to_qlistwidgetitem (Args[0]); if (item) { item = lw->takeItem (lw->row (item)); if (item) { result = self->create_v8_qlistwidgetitem (item); } } } } } return scope.Close (result); }
/*static*/ v8::Handle<v8::Value> wxNode_wxSizerFlags::_GetBorderInPixels(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxSizerFlags* self = unwrap<wxNode_wxSizerFlags>(args.This()); /* * id: _40903 */ if(args.Length() == 0) { int returnVal = self->GetBorderInPixels(); return scope.Close(v8::Number::New(returnVal)); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxSizerFlags::GetBorderInPixels).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
/*static*/ v8::Handle<v8::Value> wxNode_wxMenuBar::_Replace(const v8::Arguments& args) { v8::HandleScope scope; wxNode_wxMenuBar* self = unwrap<wxNode_wxMenuBar>(args.This()); /* * id: _39743 */ if(args.Length() == 3 && args[0]->IsNumber() && (args[1]->IsNull() || (args[1]->IsObject() && wxNode_wxMenu::AssignableFrom(args[1]->ToObject()->GetConstructorName()))) && args[2]->IsString()) { unsigned int pos = (unsigned int)args[0]->ToInt32()->Value(); /* type: _8711 */ wxNode_wxMenu* menu = args[1]->IsNull() ? NULL : wxNodeObject::unwrap<wxNode_wxMenu>(args[1]->ToObject()); /* type: _53132 * */ v8::String::AsciiValue title(args[2]->ToString()); /* type: _14975 */ wxMenu* returnVal = self->Replace(pos, menu, *title); return scope.Close(wxNode_wxMenu::New(returnVal)); } std::ostringstream errStr; errStr << "Could not find matching method for arguments (method name: wxMenuBar::Replace).\n"; errStr << " arg count: " << args.Length() << "\n"; for(int i = 0; i < args.Length(); i++) { v8::String::AsciiValue argStr(args[i]); errStr << " arg[" << i << "]: " << *argStr << "\n"; } return v8::ThrowException(v8::Exception::TypeError(v8::String::New(errStr.str().c_str()))); }
v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args) { if (!AllowAllocation::m_current) return throwError(TypeError, "Illegal constructor"); return args.This(); }
//utility function for working with handler objects. pass in args for a //call, get back the jsobjectscript that called it, and the matching pattern and //callback function that are associated with the handler objects. void readHandler(const v8::Arguments& args, EmersonScript*& caller, JSEventHandlerStruct*& hand) { v8::Local<v8::Object> mHand = args.This(); //grabs the caller v8::Local<v8::External> wrapJSObj; if (mHand->InternalFieldCount() > 0) wrapJSObj = v8::Local<v8::External>::Cast( mHand->GetInternalField(JSHANDLER_JSOBJSCRIPT_FIELD) ); else wrapJSObj = v8::Local<v8::External>::Cast( v8::Handle<v8::Object>::Cast(mHand->GetPrototype())->GetInternalField(JSHANDLER_JSOBJSCRIPT_FIELD) ); void* ptr = wrapJSObj->Value(); caller = static_cast<EmersonScript*>(ptr); //grabs the internal pattern //(which has been saved as a pointer to JSEventHandler v8::Local<v8::External> wrapEventHand; if (mHand->InternalFieldCount() > 0) wrapEventHand = v8::Local<v8::External>::Cast( mHand->GetInternalField(JSHANDLER_JSEVENTHANDLER_FIELD) ); else wrapEventHand = v8::Local<v8::External>::Cast( v8::Handle<v8::Object>::Cast(mHand->GetPrototype())->GetInternalField(JSHANDLER_JSEVENTHANDLER_FIELD) ); void* ptr2 = wrapEventHand->Value(); hand = static_cast<JSEventHandlerStruct*>(ptr2); }