#ifdef NANOGUI_PYTHON #include "python.h" typedef IntBox Int64Box; void register_formhelper(py::module &m) { enum DummyEnum { }; py::class_(m, "FormHelper", D(FormHelper)) .def(py::init(), D(FormHelper, FormHelper)) .def("addWindow", &FormHelper::addWindow, py::arg("pos"), py::arg("title") = std::string("Untitled"), D(FormHelper, addWindow)) .def("addGroup", &FormHelper::addGroup, D(FormHelper, addGroup)) .def("addButton", &FormHelper::addButton, py::arg("label"), py::arg("cb"), D(FormHelper, addGroup)) .def("addBoolVariable", [](FormHelper &h, const std::string &label, const std::function &setter, const std::function &getter, bool editable) -> CheckBox* { return h.addVariable(label, setter, getter, editable); }, py::arg("label"), py::arg("setter"), py::arg("getter"), py::arg("editable") = true) .def("addIntVariable", [](FormHelper &h, const std::string &label, const std::function &setter, const std::function &getter, bool editable) -> Int64Box* { return h.addVariable(label, setter, getter, editable); }, py::arg("label"), py::arg("setter"), py::arg("getter"), py::arg("editable") = true) .def("addDoubleVariable", [](FormHelper &h, const std::string &label, const std::function &setter, const std::function &getter, bool editable) -> FloatBox* { return h.addVariable(label, setter, getter, editable); }, py::arg("label"), py::arg("setter"), py::arg("getter"), py::arg("editable") = true) .def("addStringVariable", [](FormHelper &h, const std::string &label, const std::function &setter, const std::function &getter, bool editable) -> TextBox* { return h.addVariable(label, setter, getter, editable); }, py::arg("label"), py::arg("setter"), py::arg("getter"), py::arg("editable") = true) .def("addColorVariable", [](FormHelper &h, const std::string &label, const std::function &setter, const std::function &getter, bool editable) -> ColorPicker* { return h.addVariable(label, setter, getter, editable); }, py::arg("label"), py::arg("setter"), py::arg("getter"), py::arg("editable") = true) .def("addEnumVariable", [](FormHelper &h, const std::string &label, const std::function &setter, const std::function &getter, bool editable) -> ComboBox* { return h.addVariable(label, reinterpret_cast&>(setter), reinterpret_cast&>(getter), editable); }, py::arg("label"), py::arg("setter"), py::arg("getter"), py::arg("editable") = true) .def("addWidget", &FormHelper::addWidget, D(FormHelper, addWidget)) .def("refresh", &FormHelper::refresh, D(FormHelper, refresh)) .def("window", &FormHelper::window, D(FormHelper, window)) .def("setWindow", &FormHelper::setWindow, D(FormHelper, setWindow)) .def("fixedSize", &FormHelper::fixedSize, D(FormHelper, fixedSize)) .def("setFixedSize", &FormHelper::setFixedSize, D(FormHelper, setFixedSize)) .def("groupFontName", &FormHelper::groupFontName, D(FormHelper, groupFontName)) .def("setGroupFontName", &FormHelper::setGroupFontName, D(FormHelper, setGroupFontName)) .def("labelFontName", &FormHelper::labelFontName, D(FormHelper, labelFontName)) .def("setLabelFontName", &FormHelper::setLabelFontName, D(FormHelper, setLabelFontName)) .def("groupFontSize", &FormHelper::groupFontSize, D(FormHelper, groupFontSize)) .def("setGroupFontSize", &FormHelper::setGroupFontSize, D(FormHelper, setGroupFontSize)) .def("labelFontSize", &FormHelper::labelFontSize, D(FormHelper, labelFontSize)) .def("setLabelFontSize", &FormHelper::setLabelFontSize, D(FormHelper, setLabelFontSize)) .def("widgetFontSize", &FormHelper::widgetFontSize, D(FormHelper, widgetFontSize)) .def("setWidgetFontSize", &FormHelper::setWidgetFontSize, D(FormHelper, setWidgetFontSize)); } #endif