1 | #ifdef NANOGUI_PYTHON |
2 | |
3 | #include "python.h" |
4 | |
5 | DECLARE_WIDGET(StackedWidget); |
6 | DECLARE_WIDGET(TabHeader); |
7 | DECLARE_WIDGET(TabWidget); |
8 | |
9 | void register_tabs(py::module &m) { |
10 | py::class_<StackedWidget, Widget, ref<StackedWidget>, PyStackedWidget>(m, "StackedWidget" , D(StackedWidget)) |
11 | .def(py::init<Widget *>(), D(StackedWidget, StackedWidget)) |
12 | .def("selectedIndex" , &StackedWidget::selectedIndex, D(StackedWidget, selectedIndex)) |
13 | .def("setSelectedIndex" , &StackedWidget::setSelectedIndex, D(StackedWidget, setSelectedIndex)); |
14 | |
15 | py::class_<TabHeader, Widget, ref<TabHeader>, PyTabHeader>(m, "TabHeader" , D(TabHeader)) |
16 | .def(py::init<Widget *, const std::string &>(), D(TabHeader, TabHeader)) |
17 | .def("setFont" , &TabHeader::setFont, D(TabHeader, setFont)) |
18 | .def("font" , &TabHeader::font, D(TabHeader, font)) |
19 | .def("overflowing" , &TabHeader::overflowing, D(TabHeader, overflowing)) |
20 | .def("callback" , &TabHeader::callback, D(TabHeader, callback)) |
21 | .def("setCallback" , &TabHeader::setCallback, D(TabHeader, setCallback)) |
22 | .def("activeTab" , &TabHeader::activeTab, D(TabHeader, activeTab)) |
23 | .def("setActiveTab" , &TabHeader::setActiveTab, D(TabHeader, setActiveTab)) |
24 | .def("addTab" , (void (TabHeader::*)(const std::string &)) &TabHeader::addTab, D(TabHeader, addTab)) |
25 | .def("addTab" , (void (TabHeader::*)(int index, const std::string &)) &TabHeader::addTab, D(TabHeader, addTab, 2)) |
26 | .def("removeTab" , (int (TabHeader::*)(const std::string &)) &TabHeader::removeTab, D(TabHeader, removeTab)) |
27 | .def("removeTab" , (void (TabHeader::*)(int index)) &TabHeader::removeTab, D(TabHeader, removeTab, 2)) |
28 | .def("tabLabelAt" , &TabHeader::tabLabelAt, D(TabHeader, tabLabelAt)) |
29 | .def("tabIndex" , &TabHeader::tabIndex, D(TabHeader, tabIndex)) |
30 | .def("ensureTabVisible" , &TabHeader::ensureTabVisible, D(TabHeader, ensureTabVisible)); |
31 | |
32 | py::class_<TabWidget, Widget, ref<TabWidget>, PyTabWidget>(m, "TabWidget" , D(TabWidget)) |
33 | .def(py::init<Widget *>(), D(TabWidget, TabWidget)) |
34 | .def("setActiveTab" , &TabWidget::setActiveTab, D(TabWidget, setActiveTab)) |
35 | .def("activeTab" , &TabWidget::activeTab, D(TabWidget, activeTab)) |
36 | .def("tabCount" , &TabWidget::tabCount, D(TabWidget, tabCount)) |
37 | .def("setCallback" , &TabWidget::setCallback, D(TabWidget, setCallback)) |
38 | .def("callback" , &TabWidget::callback, D(TabWidget, callback)) |
39 | .def("addTab" , (void (TabWidget::*)(const std::string &, Widget *)) &TabWidget::addTab, D(TabWidget, addTab)) |
40 | .def("addTab" , (void (TabWidget::*)(int index, const std::string &, Widget *)) &TabWidget::addTab, D(TabWidget, addTab, 2)) |
41 | .def("createTab" , (Widget *(TabWidget::*)(const std::string &)) &TabWidget::createTab, D(TabWidget, createTab)) |
42 | .def("createTab" , (Widget *(TabWidget::*)(int index, const std::string &)) &TabWidget::createTab, D(TabWidget, createTab, 2)) |
43 | .def("removeTab" , (bool (TabWidget::*)(const std::string &)) &TabWidget::removeTab, D(TabWidget, removeTab)) |
44 | .def("removeTab" , (void (TabWidget::*)(int index)) &TabWidget::removeTab, D(TabWidget, removeTab, 2)) |
45 | .def("tabLabelAt" , &TabWidget::tabLabelAt, D(TabWidget, tabLabelAt)) |
46 | .def("tabIndex" , &TabWidget::tabIndex, D(TabWidget, tabIndex)) |
47 | .def("tab" , (Widget * (TabWidget::*)(const std::string &)) &TabWidget::tab, D(TabWidget, tab)) |
48 | .def("tab" , (Widget * (TabWidget::*)(int)) &TabWidget::tab, D(TabWidget, tab)) |
49 | .def("ensureTabVisible" , &TabWidget::ensureTabVisible, D(TabWidget, ensureTabVisible)); |
50 | } |
51 | |
52 | #endif |
53 | |