Skip to content

Commit 936661d

Browse files
committed
GetSelection returns tuple of int32
1 parent f168f57 commit 936661d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bindings/interface/TextView.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,13 @@ py::class_<BTextView, PyBTextView, BView, std::unique_ptr<BTextView,py::nodelete
243243
.def("AcceptsDrop", &BTextView::AcceptsDrop, "", py::arg("message"))
244244
.def("Select", &BTextView::Select, "", py::arg("startOffset"), py::arg("endOffset"))
245245
.def("SelectAll", &BTextView::SelectAll, "")
246-
.def("GetSelection", &BTextView::GetSelection, "", py::arg("_start"), py::arg("_end"))
246+
//.def("GetSelection", &BTextView::GetSelection, "", py::arg("_start"), py::arg("_end"))
247+
.def("GetSelection", [](BTextView& self)-> std::tuple<int32,int32>{
248+
int32 start;
249+
int32 end;
250+
self.GetSelection(&start,&end);
251+
return std::make_tuple(start,end);
252+
}, "")
247253
//.def("SetFontAndColor", static_cast<void (BTextView::*)(const BFont*, uint32, const rgb_color*)>(&BTextView::SetFontAndColor), "", py::arg("font"), py::arg("mode")=B_FONT_ALL, py::arg("color")=NULL)
248254
.def("SetFontAndColor", py::overload_cast<const BFont *, uint32, const rgb_color *>(&BTextView::SetFontAndColor), "", py::arg("font"), py::arg("mode")=B_FONT_ALL, py::arg("color")=NULL)
249255
//.def("SetFontAndColor", static_cast<void (BTextView::*)(int32, int32, const BFont *, uint32, const rgb_color *)>(&BTextView::SetFontAndColor), "", py::arg("startOffset"), py::arg("endOffset"), py::arg("font"), py::arg("mode")=B_FONT_ALL, py::arg("color")=NULL)

0 commit comments

Comments
 (0)