void dmz::JsExtV8Input::receive_switch_event ( const Handle Channel, const InputEventSwitch &Value) { if (_v8Context.IsEmpty () == false) { v8::Context::Scope cscope(_v8Context); v8::HandleScope scope; V8Object event = v8::Object::New (); event->Set (_sourceStr, v8::Integer::New (Value.get_source_handle ())); event->Set (_idStr, v8::Integer::New (Value.get_switch_id ())); event->Set (_valueStr, v8::Integer::New (Value.get_switch_value ())); event->Set (_previousStr, v8::Integer::New (Value.get_switch_previous_value ())); const int Argc (3); V8Value argv[Argc]; argv[0] = v8::Integer::New (Channel); argv[1] = event; _do_all_callbacks (Argc, argv, _leverTable); } }
void dmz::JsExtV8Input::receive_key_event ( const Handle Channel, const InputEventKey &Value) { if (_v8Context.IsEmpty () == false) { v8::Context::Scope cscope(_v8Context); v8::HandleScope scope; V8Object event = v8::Object::New (); event->Set (_sourceStr, v8::Integer::New (Value.get_source_handle ())); event->Set (_keyStr, v8::Integer::New (Value.get_key ())); event->Set (_stateStr, v8::Boolean::New (Value.get_key_state ())); const int Argc (3); V8Value argv[Argc]; argv[0] = v8::Integer::New (Channel); argv[1] = event; _do_all_callbacks (Argc, argv, _keyTable); } }
dmz::V8Value dmz::JsModuleUiV8QtBasic::_mouse_event_posf (const v8::Arguments &Args) { v8::HandleScope scope; V8Object result; JsModuleUiV8QtBasic *self = _to_self (Args); if (self) { QMouseEvent *event = (QMouseEvent *)self->_to_qevent (Args.This ()); if (event) { QPointF pos = event->posF (); result = v8::Object::New (); result->Set(v8::String::NewSymbol ("x"), v8::Number::New (pos.x ())); result->Set(v8::String::NewSymbol ("y"), v8::Number::New (pos.y ())); } } return scope.Close (result); }