1#ifdef NANOGUI_PYTHON
2
3#include "python.h"
4
5DECLARE_WIDGET(ColorWheel);
6DECLARE_WIDGET(ColorPicker);
7DECLARE_WIDGET(Graph);
8DECLARE_WIDGET(ImageView);
9DECLARE_WIDGET(ImagePanel);
10
11void register_misc(py::module &m) {
12 py::class_<ColorWheel, Widget, ref<ColorWheel>, PyColorWheel>(m, "ColorWheel", D(ColorWheel))
13 .def(py::init<Widget *>(), py::arg("parent"), D(ColorWheel, ColorWheel))
14 .def(py::init<Widget *, const Color &>(), py::arg("parent"), py::arg("Color"))
15 .def("color", &ColorWheel::color, D(ColorWheel, color))
16 .def("setColor", &ColorWheel::setColor, D(ColorWheel, setColor))
17 .def("callback", &ColorWheel::callback, D(ColorWheel, callback))
18 .def("setCallback", &ColorWheel::setCallback, D(ColorWheel, setCallback));
19
20 py::class_<ColorPicker, PopupButton, ref<ColorPicker>, PyColorPicker>(m, "ColorPicker", D(ColorPicker))
21 .def(py::init<Widget *>(), py::arg("parent"), D(ColorPicker, ColorPicker))
22 .def(py::init<Widget *, const Color &>(), py::arg("parent"), py::arg("Color"))
23 .def("color", &ColorPicker::color, D(ColorPicker, color))
24 .def("setColor", &ColorPicker::setColor, D(ColorPicker, setColor))
25 .def("callback", &ColorPicker::callback, D(ColorPicker, callback))
26 .def("setCallback", &ColorPicker::setCallback, D(ColorPicker, setCallback))
27 .def("finalCallback", &ColorPicker::finalCallback, D(ColorPicker, finalCallback))
28 .def("setFinalCallback", &ColorPicker::setFinalCallback, D(ColorPicker, setFinalCallback));
29
30 py::class_<Graph, Widget, ref<Graph>, PyGraph>(m, "Graph", D(Graph))
31 .def(py::init<Widget *, const std::string &>(), py::arg("parent"),
32 py::arg("caption") = std::string("Untitled"), D(Graph, Graph))
33 .def("caption", &Graph::caption, D(Graph, caption))
34 .def("setCaption", &Graph::setCaption, D(Graph, setCaption))
35 .def("header", &Graph::header, D(Graph, header))
36 .def("setHeader", &Graph::setHeader, D(Graph, setHeader))
37 .def("footer", &Graph::footer, D(Graph, footer))
38 .def("setFooter", &Graph::setFooter, D(Graph, setFooter))
39 .def("backgroundColor", &Graph::backgroundColor, D(Graph, backgroundColor))
40 .def("setBackgroundColor", &Graph::setBackgroundColor, D(Graph, setBackgroundColor))
41 .def("foregroundColor", &Graph::foregroundColor, D(Graph, foregroundColor))
42 .def("setForegroundColor", &Graph::setForegroundColor, D(Graph, setForegroundColor))
43 .def("textColor", &Graph::textColor, D(Graph, textColor))
44 .def("setTextColor", &Graph::setTextColor, D(Graph, setTextColor))
45 .def("values", (VectorXf &(Graph::*)(void)) &Graph::values, D(Graph, values))
46 .def("setValues", &Graph::setValues, D(Graph, setValues));
47
48 py::class_<ImageView, Widget, ref<ImageView>, PyImageView>(m, "ImageView", D(ImageView))
49 .def(py::init<Widget *, GLuint>(), D(ImageView, ImageView))
50 .def("bindImage", &ImageView::bindImage, D(ImageView, bindImage))
51 .def("imageShader", &ImageView::imageShader, D(ImageView, imageShader))
52 .def("scaledImageSize", &ImageView::scaledImageSize, D(ImageView, scaledImageSize))
53 .def("offset", &ImageView::offset, D(ImageView, offset))
54 .def("setOffset", &ImageView::setOffset, D(ImageView, setOffset))
55 .def("scale", &ImageView::scale, D(ImageView, scale))
56 .def("fixedOffset", &ImageView::fixedOffset, D(ImageView, fixedOffset))
57 .def("setFixedOffset", &ImageView::setFixedOffset, D(ImageView, setFixedOffset))
58 .def("fixedScale", &ImageView::fixedScale, D(ImageView, fixedScale))
59 .def("setFixedScale", &ImageView::setFixedScale, D(ImageView, setFixedScale))
60 .def("zoomSensitivity", &ImageView::zoomSensitivity, D(ImageView, zoomSensitivity))
61 .def("setZoomSensitivity", &ImageView::setZoomSensitivity, D(ImageView, setZoomSensitivity))
62 .def("gridThreshold", &ImageView::gridThreshold, D(ImageView, gridThreshold))
63 .def("setGridThreshold", &ImageView::setGridThreshold, D(ImageView, setGridThreshold))
64 .def("pixelInfoThreshold", &ImageView::pixelInfoThreshold, D(ImageView, pixelInfoThreshold))
65 .def("setPixelInfoThreshold", &ImageView::setPixelInfoThreshold, D(ImageView, setPixelInfoThreshold))
66 .def("setPixelInfoCallback", &ImageView::setPixelInfoCallback, D(ImageView, setPixelInfoCallback))
67 .def("pixelInfoCallback", &ImageView::pixelInfoCallback, D(ImageView, pixelInfoCallback))
68 .def("setFontScaleFactor", &ImageView::setFontScaleFactor, D(ImageView, setFontScaleFactor))
69 .def("fontScaleFactor", &ImageView::fontScaleFactor, D(ImageView, fontScaleFactor))
70 .def("imageCoordinateAt", &ImageView::imageCoordinateAt, D(ImageView, imageCoordinateAt))
71 .def("clampedImageCoordinateAt", &ImageView::clampedImageCoordinateAt, D(ImageView, clampedImageCoordinateAt))
72 .def("positionForCoordinate", &ImageView::positionForCoordinate, D(ImageView, positionForCoordinate))
73 .def("setImageCoordinateAt", &ImageView::setImageCoordinateAt, D(ImageView, setImageCoordinateAt))
74 .def("center",&ImageView::center, D(ImageView, center))
75 .def("fit", &ImageView::fit, D(ImageView, fit))
76 .def("setScaleCentered", &ImageView::setScaleCentered, D(ImageView, setScaleCentered))
77 .def("moveOffset", &ImageView::moveOffset, D(ImageView, moveOffset))
78 .def("zoom", &ImageView::zoom, D(ImageView, zoom))
79 .def("gridVisible", &ImageView::gridVisible, D(ImageView, gridVisible))
80 .def("pixelInfoVisible", &ImageView::pixelInfoVisible, D(ImageView, pixelInfoVisible))
81 .def("helpersVisible", &ImageView::helpersVisible, D(ImageView, helpersVisible));
82
83 py::class_<ImagePanel, Widget, ref<ImagePanel>, PyImagePanel>(m, "ImagePanel", D(ImagePanel))
84 .def(py::init<Widget *>(), py::arg("parent"), D(ImagePanel, ImagePanel))
85 .def("images", &ImagePanel::images, D(ImagePanel, images))
86 .def("setImages", &ImagePanel::setImages, D(ImagePanel, setImages))
87 .def("callback", &ImagePanel::callback, D(ImagePanel, callback))
88 .def("setCallback", &ImagePanel::setCallback, D(ImagePanel, setCallback));
89}
90
91#endif
92