summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-12-29 09:03:14 +0100
committerAndras Timar <andras.timar@collabora.com>2021-04-09 11:56:45 +0200
commitc413cba7db9811689b52258b249b21a62c9419da (patch)
tree6a842fd44714ddafaa4ae82a781ed27f93cae229
parentf547d89135831706cb1fc27a2f7b973516402581 (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.hxx5
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx33
2 files changed, 20 insertions, 18 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 0fa94195981c..1c0a44ae548d 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -366,8 +366,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,
@@ -392,6 +390,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,