|
13 | 13 |
|
14 | 14 | namespacepy= pybind11; |
15 | 15 |
|
| 16 | +classPyBLayoutItem :publicBLayoutItem{ |
| 17 | +public: |
| 18 | +using BLayoutItem::BLayoutItem; |
| 19 | + BSizeMinSize()override { |
| 20 | +PYBIND11_OVERLOAD_PURE(BSize, BLayoutItem, MinSize); |
| 21 | + } |
| 22 | + BSizeMaxSize()override { |
| 23 | +PYBIND11_OVERLOAD_PURE(BSize, BLayoutItem, MaxSize); |
| 24 | + } |
| 25 | + BSizePreferredSize()override { |
| 26 | +PYBIND11_OVERLOAD_PURE(BSize, BLayoutItem, PreferredSize); |
| 27 | + } |
| 28 | + BAlignmentAlignment()override { |
| 29 | +PYBIND11_OVERLOAD_PURE(BAlignment, BLayoutItem, Alignment); |
| 30 | + } |
| 31 | +voidSetExplicitMinSize(BSize size)override { |
| 32 | +PYBIND11_OVERLOAD_PURE(void, BLayoutItem, SetExplicitMinSize, size); |
| 33 | + } |
| 34 | +voidSetExplicitMaxSize(BSize size)override { |
| 35 | +PYBIND11_OVERLOAD_PURE(void, BLayoutItem, SetExplicitMaxSize, size); |
| 36 | + } |
| 37 | +voidSetExplicitPreferredSize(BSize size)override { |
| 38 | +PYBIND11_OVERLOAD_PURE(void, BLayoutItem, SetExplicitPreferredSize, size); |
| 39 | + } |
| 40 | +voidSetExplicitAlignment(BAlignment alignment)override { |
| 41 | +PYBIND11_OVERLOAD_PURE(void, BLayoutItem, SetExplicitAlignment, alignment); |
| 42 | + } |
| 43 | +boolIsVisible()override { |
| 44 | +PYBIND11_OVERLOAD_PURE(bool, BLayoutItem, IsVisible); |
| 45 | + } |
| 46 | +voidSetVisible(bool visible)override { |
| 47 | +PYBIND11_OVERLOAD_PURE(void, BLayoutItem, SetVisible, visible); |
| 48 | + } |
| 49 | + BRectFrame()override { |
| 50 | +PYBIND11_OVERLOAD_PURE(BRect, BLayoutItem, Frame); |
| 51 | + } |
| 52 | +voidSetFrame(BRect frame)override { |
| 53 | +PYBIND11_OVERLOAD_PURE(void, BLayoutItem, SetFrame, frame); |
| 54 | + } |
| 55 | +boolHasHeightForWidth()override { |
| 56 | +PYBIND11_OVERLOAD(bool, BLayoutItem, HasHeightForWidth); |
| 57 | + } |
| 58 | +voidGetHeightForWidth(float width,float* min,float* max,float* preferred)override { |
| 59 | +PYBIND11_OVERLOAD(void, BLayoutItem, GetHeightForWidth, width, min, max, preferred); |
| 60 | + } |
| 61 | + BView*View()override { |
| 62 | +PYBIND11_OVERLOAD(BView*, BLayoutItem, View); |
| 63 | + } |
| 64 | +voidInvalidateLayout(bool children =false)override { |
| 65 | +PYBIND11_OVERLOAD(void, BLayoutItem, InvalidateLayout, children); |
| 66 | + } |
| 67 | +voidRelayout(bool immediate =false)override { |
| 68 | +PYBIND11_OVERLOAD(void, BLayoutItem, Relayout, immediate); |
| 69 | + } |
| 70 | +status_tArchive(BMessage* into,bool deep =true)constoverride { |
| 71 | +PYBIND11_OVERLOAD(status_t, BLayoutItem, Archive, into, deep); |
| 72 | + } |
| 73 | +status_tPerform(perform_code d,void* arg)override { |
| 74 | +PYBIND11_OVERLOAD(status_t, BLayoutItem, Perform, d, arg); |
| 75 | + } |
| 76 | +}; |
16 | 77 |
|
17 | 78 | PYBIND11_MODULE(LayoutItem,m) |
18 | 79 | { |
19 | | -py::class_<BLayoutItem,std::unique_ptr<BLayoutItem, py::nodelete>>(m,"BLayoutItem"); |
| 80 | +py::class_<BLayoutItem,PyBLayoutItem,std::unique_ptr<BLayoutItem, py::nodelete>>(m,"BLayoutItem") |
| 81 | +.def(py::init(),"") |
| 82 | +.def(py::init<BMessage *>(),"",py::arg("from")) |
| 83 | +.def("Layout", &BLayoutItem::Layout,"") |
| 84 | +.def("RemoveSelf", &BLayoutItem::RemoveSelf,"") |
| 85 | +.def("MinSize", &BLayoutItem::MinSize,"") |
| 86 | +.def("MaxSize", &BLayoutItem::MaxSize,"") |
| 87 | +.def("PreferredSize", &BLayoutItem::PreferredSize,"") |
| 88 | +.def("Alignment", &BLayoutItem::Alignment,"") |
| 89 | +.def("SetExplicitMinSize", &BLayoutItem::SetExplicitMinSize,"",py::arg("size")) |
| 90 | +.def("SetExplicitMaxSize", &BLayoutItem::SetExplicitMaxSize,"",py::arg("size")) |
| 91 | +.def("SetExplicitPreferredSize", &BLayoutItem::SetExplicitPreferredSize,"",py::arg("size")) |
| 92 | +.def("SetExplicitSize", &BLayoutItem::SetExplicitSize,"",py::arg("size")) |
| 93 | +.def("SetExplicitAlignment", &BLayoutItem::SetExplicitAlignment,"",py::arg("alignment")) |
| 94 | +.def("IsVisible", &BLayoutItem::IsVisible,"") |
| 95 | +.def("SetVisible", &BLayoutItem::SetVisible,"",py::arg("visible")) |
| 96 | +.def("Frame", &BLayoutItem::Frame,"") |
| 97 | +.def("SetFrame", &BLayoutItem::SetFrame,"",py::arg("frame")) |
| 98 | +.def("HasHeightForWidth", &BLayoutItem::HasHeightForWidth,"") |
| 99 | +.def("GetHeightForWidth", &BLayoutItem::GetHeightForWidth,"",py::arg("width"),py::arg("min"),py::arg("max"),py::arg("preferred")) |
| 100 | +.def("View", &BLayoutItem::View,"") |
| 101 | +.def("InvalidateLayout", &BLayoutItem::InvalidateLayout,"",py::arg("children")=false) |
| 102 | +.def("Relayout", &BLayoutItem::Relayout,"",py::arg("immediate")=false) |
| 103 | +.def("LayoutData", &BLayoutItem::LayoutData,"") |
| 104 | +.def("SetLayoutData", &BLayoutItem::SetLayoutData,"",py::arg("data")) |
| 105 | +.def("AlignInFrame", &BLayoutItem::AlignInFrame,"",py::arg("frame")) |
| 106 | +.def("Archive", &BLayoutItem::Archive,"",py::arg("into"),py::arg("deep")=true) |
| 107 | +.def("Perform", &BLayoutItem::Perform,"",py::arg("d"),py::arg("arg")) |
| 108 | +; |
20 | 109 | } |