diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-12-29 09:03:14 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-01-05 09:39:13 +0100 |
commit | abd08df65e278eb91c83051d07b459d2e7f420ca (patch) | |
tree | 23d7cd83769b89bb3b95d0d06741a7cee03051e9 | |
parent | ae368d3e1b9fffd75b853e74a85765b58dda9544 (diff) |
jsdialog: direct updates for treeview
We should use only weld:: interfaces methods
to detect moment of control's updates as all
the modifications goes through weld:: API.
Let's use higher abstraction layer and not use
vcl implementation details.
this reverts partially: 32bfa0e1c7e859aedc3988d5bfdf86f5d7bab98a
Change-Id: I2dd25c08dae3f5a95d077e2715788d636be47fe4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108433
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 5 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 33 |
2 files changed, 20 insertions, 18 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 8574124d7de4..26fd022b1485 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -394,8 +394,6 @@ public: class JSTreeView : public JSWidget<SalInstanceTreeView, ::SvTabListBox> { - DECL_LINK(on_window_event, VclWindowEvent&, void); - public: JSTreeView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder, bool bTakeOwnership, @@ -420,6 +418,9 @@ public: virtual void set_text(int row, const OUString& rText, int col = -1) override; virtual void set_text(const weld::TreeIter& rIter, const OUString& rStr, int col = -1) override; + virtual void expand_row(const weld::TreeIter& rIter) override; + virtual void collapse_row(const weld::TreeIter& rIter) override; + void drag_start(); void drag_end(); }; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index f0fb911d8f23..8fba06677b74 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -980,8 +980,6 @@ JSTreeView::JSTreeView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> : JSWidget<SalInstanceTreeView, ::SvTabListBox>(aNotifierWindow, aContentWindow, pTreeView, pBuilder, bTakeOwnership, sTypeOfJSON) { - if (aNotifierWindow && aNotifierWindow->IsDisableIdleNotify()) - pTreeView->AddEventListener(LINK(this, JSTreeView, on_window_event)); } void JSTreeView::set_toggle(int pos, TriState eState, int col) @@ -996,7 +994,7 @@ void JSTreeView::set_toggle(int pos, TriState eState, int col) SalInstanceTreeView::set_toggle(pEntry, eState, col); signal_toggled(iter_col(SalInstanceTreeIter(pEntry), col)); - notifyDialogState(); + sendUpdate(m_xTreeView); } } @@ -1042,21 +1040,12 @@ void JSTreeView::drag_end() m_xDropTarget->fire_drop(aEvent); - notifyDialogState(); + sendUpdate(m_xTreeView); } g_DragSource = nullptr; } -IMPL_LINK(JSTreeView, on_window_event, VclWindowEvent&, rEvent, void) -{ - if (rEvent.GetId() == VclEventId::WindowPaint && get_visible() && m_xTreeView->IsDirtyModel()) - { - sendUpdate(m_xTreeView); - m_xTreeView->SetDirtyModel(false); - } -} - void JSTreeView::insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface, bool bChildrenOnDemand, weld::TreeIter* pRet) @@ -1064,19 +1053,31 @@ void JSTreeView::insert(const weld::TreeIter* pParent, int pos, const OUString* SalInstanceTreeView::insert(pParent, pos, pStr, pId, pIconName, pImageSurface, bChildrenOnDemand, pRet); - notifyDialogState(); + sendUpdate(m_xTreeView); } void JSTreeView::set_text(int row, const OUString& rText, int col) { SalInstanceTreeView::set_text(row, rText, col); - notifyDialogState(); + sendUpdate(m_xTreeView); } void JSTreeView::set_text(const weld::TreeIter& rIter, const OUString& rStr, int col) { SalInstanceTreeView::set_text(rIter, rStr, col); - notifyDialogState(); + sendUpdate(m_xTreeView); +} + +void JSTreeView::expand_row(const weld::TreeIter& rIter) +{ + SalInstanceTreeView::expand_row(rIter); + sendUpdate(m_xTreeView); +} + +void JSTreeView::collapse_row(const weld::TreeIter& rIter) +{ + SalInstanceTreeView::collapse_row(rIter); + sendUpdate(m_xTreeView); } JSExpander::JSExpander(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, |