Beispiel #1
0
dmz::V8Value
dmz::JsExtV8Input::_input_channel (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();
   JsExtV8Input *self = _to_self (Args);
   InputModule *input = self ? self->get_input_module () : 0;

   if (self && input) {

      const int Length = Args.Length ();

      if (Length == 1) {

         const Handle Channel = self->_to_handle (Args[0]);

         if (Channel) {

            result = v8::Boolean::New (input->get_channel_state (Channel));
         }
      }
      else if (Length > 1) {

         const Handle Channel = self->_to_handle (Args[0]);
         const Boolean State = v8_to_boolean (Args[1]);

         if (Channel) {

            result = v8::Boolean::New (input->set_channel_state (Channel, State));
         }
      }
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_layout_enabled (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) {

            bool val = v8_to_boolean (Args[0]);
            layout->setEnabled (val);
         }

         result = v8::Boolean::New (layout->isEnabled ());
      }
   }

   return scope.Close (result);
}