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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 20 17:27:48 UTC 2020


 include/vcl/weld.hxx          |    1 +
 vcl/source/app/salvtables.cxx |    5 +++++
 vcl/unx/gtk3/gtk3gtkinst.cxx  |   21 +++++++++++++++++++++
 3 files changed, 27 insertions(+)

New commits:
commit 901ae316b919680d59b064c6f79fb0910e6be7da
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jan 19 17:52:36 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 20 18:27:17 2020 +0100

    add get_row_area for TreeView
    
    Change-Id: I0fa8e3666f6731abb831d0ba62f128614eae261c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87048
    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 9aa93cbe84ec..9ac53dd91a9e 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1024,6 +1024,7 @@ public:
 
     // for dnd
     virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) = 0;
+    virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 0;
     // for dragging and dropping between TreeViews, return the active source
     virtual TreeView* get_drag_source() const = 0;
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 1603033ded71..3b6697755bf0 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4745,6 +4745,11 @@ public:
         return pTarget != nullptr;
     }
 
+    virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override
+    {
+        return m_xTreeView->GetBoundingRect(static_cast<const SalInstanceTreeIter&>(rIter).iter);
+    }
+
     virtual TreeView* get_drag_source() const override
     {
         return g_DragSource;
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f146049dffd2..024b71c782e6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -10189,6 +10189,27 @@ public:
         return ret;
     }
 
+    virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override
+    {
+        tools::Rectangle aRet;
+
+        const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);
+        GtkTreeModel* pModel = GTK_TREE_MODEL(m_pTreeStore);
+        GtkTreePath* pPath = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter));
+
+        GdkRectangle aRect;
+        for (GList* pEntry = g_list_last(m_pColumns); pEntry; pEntry = g_list_previous(pEntry))
+        {
+            GtkTreeViewColumn* pColumn = GTK_TREE_VIEW_COLUMN(pEntry->data);
+            gtk_tree_view_get_cell_area(m_pTreeView, pPath, pColumn, &aRect);
+            aRet.Union(tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height));
+        }
+
+        gtk_tree_path_free(pPath);
+
+        return aRet;
+    }
+
     virtual void start_editing(const weld::TreeIter& rIter) override
     {
         int col = get_view_col(m_nTextCol);


More information about the Libreoffice-commits mailing list