[Libreoffice-commits] core.git: include/vcl vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 12 18:24:54 UTC 2020


 include/vcl/weld.hxx         |    6 +++++-
 vcl/unx/gtk3/gtk3gtkinst.cxx |    2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 7956d0593cec116d05ca205dab8c7ae1646b6db0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 12 15:59:40 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Aug 12 20:24:10 2020 +0200

    tdf#135640 ensure parent rows are expanded on scolling to make a row visible
    
    Change-Id: I37e55ed8d0d3d5916950228ba78982b90356fbc2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100606
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4707d3905176..b2080c671874 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -939,7 +939,9 @@ public:
     virtual void swap(int pos1, int pos2) = 0;
     virtual std::vector<int> get_selected_rows() const = 0;
     virtual void set_font_color(int pos, const Color& rColor) = 0;
-    virtual void scroll_to_row(int pos) = 0;
+    // scroll to make 'row' visible, this will also expand all parent rows of 'row' as necessary to
+    // make 'row' visible
+    virtual void scroll_to_row(int row) = 0;
     virtual bool is_selected(int pos) const = 0;
     virtual int get_cursor_index() const = 0;
     virtual void set_cursor(int pos) = 0;
@@ -1043,6 +1045,8 @@ public:
                            const css::uno::Reference<css::graphic::XGraphic>& rImage, int col = -1)
         = 0;
     virtual void set_font_color(const TreeIter& rIter, const Color& rColor) = 0;
+    // scroll to make rIter visible, this will also expand all parent rows of rIter as necessary to
+    // make rIter visible
     virtual void scroll_to_row(const TreeIter& rIter) = 0;
     virtual bool is_selected(const TreeIter& rIter) const = 0;
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 5b7ee9c17fb3..ade418e30d01 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10452,6 +10452,7 @@ public:
         assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen, select after thaw. Note selection doesn't survive a freeze");
         disable_notify_events();
         GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1);
+        gtk_tree_view_expand_to_path(m_pTreeView, path);
         gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
         gtk_tree_path_free(path);
         enable_notify_events();
@@ -11158,6 +11159,7 @@ public:
         const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
         GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
         GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
+        gtk_tree_view_expand_to_path(m_pTreeView, path);
         gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
         gtk_tree_path_free(path);
         enable_notify_events();


More information about the Libreoffice-commits mailing list