vcl/source/treelist/treelistbox.cxx | 5 ++++ vcl/source/window/builder.cxx | 40 ++++++++++++++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-)
New commits: commit b440aea0a0b90b7e6700ee7f6f26e0139089c05d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Mar 7 13:59:01 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Mar 7 22:54:08 2019 +0100 map reorderable to DragDropMode::CTRL_MOVE workaround baseclass NotifyStartDrag weirdness rather than risk changing it Change-Id: I70b56a913e6192da9b3a57653924dcc4160352c0 Reviewed-on: https://gerrit.libreoffice.org/68879 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 7355f06ca915..586b9073c2cb 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -3655,6 +3655,11 @@ bool SvTreeListBox::set_property(const OString &rKey, const OUString &rValue) { SetQuickSearch(toBool(rValue)); } + else if (rKey == "reorderable") + { + if (toBool(rValue)) + SetDragDropMode(DragDropMode::CTRL_MOVE); + } else return Control::set_property(rKey, rValue); return true; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 1e363d451c99..5969211017fd 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1595,6 +1595,42 @@ void VclBuilder::preload() extern "C" VclBuilder::customMakeWidget lo_get_custom_widget_func(const char* name); #endif +namespace +{ + //the default NotifyStartDrag is weird to me, and defaults to enabling all + //possibilities when drag starts, while restricting it to some subset of + //the configured drag drop mode would make more sense to me, but I'm not + //going to change the baseclass + + class LclHeaderTabListBox : public SvHeaderTabListBox + { + public: + LclHeaderTabListBox(vcl::Window* pParent, WinBits nWinStyle) + : SvHeaderTabListBox(pParent, nWinStyle) + { + } + + virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override + { + return GetDragDropMode(); + } + }; + + class LclTabListBox : public SvTabListBox + { + public: + LclTabListBox(vcl::Window* pParent, WinBits nWinStyle) + : SvTabListBox(pParent, nWinStyle) + { + } + + virtual DragDropMode NotifyStartDrag(TransferDataContainer&, SvTreeListEntry*) override + { + return GetDragDropMode(); + } + }; +} + VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &name, const OString &id, stringmap &rMap) { @@ -1970,7 +2006,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & xHeader->SetHelpId(m_sHelpRoot + headerid); m_aChildren.emplace_back(headerid, xHeader, true); - VclPtr<SvHeaderTabListBox> xHeaderBox = VclPtr<SvHeaderTabListBox>::Create(xContainer, nWinStyle); + VclPtr<LclHeaderTabListBox> xHeaderBox = VclPtr<LclHeaderTabListBox>::Create(xContainer, nWinStyle); xHeaderBox->InitHeaderBar(xHeader); xContainer->set_expand(true); xHeader->Show(); @@ -1980,7 +2016,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & } else { - xBox = VclPtr<SvTabListBox>::Create(pRealParent, nWinStyle); + xBox = VclPtr<LclTabListBox>::Create(pRealParent, nWinStyle); xWindowForPackingProps = xBox; } xWindow = xBox; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits