summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-03-07 13:59:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-03-07 22:54:08 +0100
commitb440aea0a0b90b7e6700ee7f6f26e0139089c05d (patch)
treee25f9d990beb2ac111485dcc971e5d5b92dee143 /vcl
parent6ec9b13579accd436eb69247336b219fdad8a22c (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/treelist/treelistbox.cxx5
-rw-r--r--vcl/source/window/builder.cxx40
2 files changed, 43 insertions, 2 deletions
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;