dmz::V8Value
dmz::JsModuleUiV8QtBasic::_form_layout_insert_row (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) {

         QLayout *layout = 0;
         QWidget *widget = 0;

         int row = v8_to_int32 (Args[0]);
         if (Args.Length () == 2) {

            layout = self->v8_to_qobject<QLayout> (Args[1]);
            widget = self->_to_qwidget (Args[1]);

            if (layout) { form->addRow (layout); }
            else if (widget) { form->addRow (widget); }
         }
         else if (Args.Length () == 3) {

            String text = v8_to_string (Args[1]);
            widget = self->_to_qwidget (Args[1]);
            QWidget *field = self->_to_qwidget (Args[2]);
            layout = self->v8_to_qobject<QLayout> (Args[2]);

            if (widget) {

               if (field) { form->insertRow (row, widget, field); }
               else if (layout) { form->insertRow (row, widget, layout); }
            }
            else if (text) {

               if (field) { form->insertRow (row, text.get_buffer (), field); }
               else if (layout) {

                  form->insertRow (row, text.get_buffer (), layout);
               }
            }
         }
      }
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_tree_item_widget (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QTreeWidget *tree = self->v8_to_qobject<QTreeWidget> (Args.This ());
      if (tree) {

         if (Args.Length () > 1) {

            QTreeWidgetItem *item = self->_to_qtreewidgetitem (Args[0]);
            int col = v8_to_uint32 (Args[1]);
            if (item) {
               if (Args.Length () > 2) {

                  tree->setItemWidget (item, col, self->_to_qwidget (Args[2]));
               }

               result = self->create_v8_qwidget (tree->itemWidget (item, col));
            }
         }
      }
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_create_message_box (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QWidget *parent = 0;
      V8Object params = v8_to_object (Args[0]);

      if (Args.Length () >= 2) {

         parent = self->_to_qwidget (Args[1]);
      }

      if (!params.IsEmpty ()) {

         QMessageBox *dialog = self->_create_message_box (params, parent);
         result = self->create_v8_qwidget (dialog);
      }
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_create_box_layout (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QWidget *parent (0);
      int direction = 0;
      if (Args.Length () > 0) {

         direction = v8_to_int32 (Args[0]);
         if ((direction < 0) || (direction > 3)) {

            direction = 0;
         }
      }

      if (Args.Length () > 1) {

         parent = self->_to_qwidget (Args[1]);
      }

      QBoxLayout *layout = new QBoxLayout((QBoxLayout::Direction)direction, parent);
      result = self->create_v8_qobject (layout);
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_create_tree_widget (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QWidget *parent = 0;
      if (Args.Length ()) { parent = self->_to_qwidget (Args[0]); }
      QTreeWidget *widget = new QTreeWidget (parent);
      result = self->create_v8_qobject (widget);
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_create_form_layout (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QWidget *parent = self->_to_qwidget (Args[0]);

      QFormLayout *layout = new QFormLayout(parent);
      result = self->create_v8_qobject (layout);
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_grid_layout_add_widget (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 ());
      QWidget *widget = self->_to_qwidget (Args[0]);

      if (grid && widget) {

         int row = v8_to_int32 (Args[1]);
         int column = v8_to_int32 (Args[2]);
         int rowSpan = -1;
         int columnSpan = -1;

         if (Args.Length () > 3) {

            rowSpan = v8_to_int32 (Args[3]);
            columnSpan = v8_to_int32 (Args[4]);
         }

         if ((row >= 0) && (column >= 0)) {

            if ((rowSpan < 0) || (columnSpan < 0)) {

               grid->addWidget (widget, row, column, 0);
            }
            else {

               grid->addWidget (widget, row, column, rowSpan, columnSpan);
            }
         }
      }
   }

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

         QWidget *widget = self->_to_qwidget (Args[0]);
         if (widget) {

            result = v8::Number::New (layout->indexOf (widget));
         }
      }
   }

   return scope.Close (result);
}
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_form_layout_row_count (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QWidget *widget = self->_to_qwidget (Args[0]);
      if (widget) {

         QFormLayout *layout = new QFormLayout (widget);
         if (layout) {

            result = v8::Number::New (layout->rowCount ());
         }
      }
   }

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

            QWidget *widget = self->_to_qwidget (Args[0]);
            if (widget) { layout->addWidget (widget); }
         }
      }
   }

   return scope.Close (result);
}