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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 28 07:43:07 UTC 2020


 include/vcl/weld.hxx          |    4 ++++
 vcl/source/app/salvtables.cxx |    8 ++++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx  |    5 +++++
 3 files changed, 17 insertions(+)

New commits:
commit 00e90218fd912525f8bfb6592cd235336e8f5496
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Apr 27 20:35:55 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Apr 28 09:42:31 2020 +0200

    add a get_drop_index for dnd interaction with toolbars
    
    Change-Id: I4c7c5cfa36d43a15509498dc4f28c10bf3fd7344
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92991
    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 d059e9cd455d..da1522787258 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2154,6 +2154,10 @@ public:
     // return what modifiers are held
     virtual sal_uInt16 get_modifier_state() const = 0;
 
+    // This function returns the position a new item should be inserted if dnd
+    // is dropped at rPoint
+    virtual int get_drop_index(const Point& rPoint) const = 0;
+
     void connect_clicked(const Link<const OString&, void>& rLink) { m_aClickHdl = rLink; }
     void connect_menu_toggled(const Link<const OString&, void>& rLink) { m_aToggleMenuHdl = rLink; }
 };
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 5ca6d0a59e52..5ec6794ab2dd 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1012,6 +1012,14 @@ public:
         return m_xToolBox->GetModifier();
     }
 
+    int get_drop_index(const Point& rPoint) const override
+    {
+        auto nRet = m_xToolBox->GetItemPos(rPoint);
+        if (nRet == ToolBox::ITEM_NOTFOUND)
+            return 0;
+        return nRet;
+    }
+
     virtual ~SalInstanceToolbar() override
     {
         m_xToolBox->SetDropdownClickHdl(Link<ToolBox*, void>());
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index cb88d8f4b486..dde9c77521f9 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8040,6 +8040,11 @@ public:
         return GtkSalFrame::GetKeyModCode(nState);
     }
 
+    int get_drop_index(const Point& rPoint) const override
+    {
+        return gtk_toolbar_get_drop_index(m_pToolbar, rPoint.X(), rPoint.Y());
+    }
+
     virtual ~GtkInstanceToolbar() override
     {
         for (auto& a : m_aMap)


More information about the Libreoffice-commits mailing list