vcl/source/window/builder.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit 97932839851ff4084f32c82442176c2114763b74
Author: Caolán McNamara <caol...@redhat.com>
Date:   Tue Apr 10 12:45:56 2018 +0100

    add GtkMenuButton support
    
    Change-Id: Id5cda4775e405ed708de09ee1332cd84461b265d
    Reviewed-on: https://gerrit.libreoffice.org/52669
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index e5eb14989237..167094a3abe1 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -602,6 +602,18 @@ namespace
         return bDrawValue;
     }
 
+    OUString extractPopupMenu(VclBuilder::stringmap& rMap)
+    {
+        OUString sRet;
+        VclBuilder::stringmap::iterator aFind = rMap.find(OString("popup"));
+        if (aFind != rMap.end())
+        {
+            sRet = aFind->second;
+            rMap.erase(aFind);
+        }
+        return sRet;
+    }
+
     OUString extractValuePos(VclBuilder::stringmap& rMap)
     {
         OUString sRet("top");
@@ -1393,6 +1405,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window 
*pParent, const OString &
             xButton = extractStockAndBuildPushButton(pParent, rMap, m_bLegacy);
         else
         {
+            assert(m_bLegacy && "use GtkMenuButton");
             xButton = extractStockAndBuildMenuButton(pParent, rMap);
             m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
         }
@@ -1400,6 +1413,17 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window 
*pParent, const OString &
         setupFromActionName(xButton, rMap, m_xFrame);
         xWindow = xButton;
     }
+    else if (name == "GtkMenuButton")
+    {
+        VclPtr<Button> xButton;
+        xButton = extractStockAndBuildMenuButton(pParent, rMap);
+        OUString sMenu = extractPopupMenu(rMap);
+        assert(!sMenu.isEmpty());
+        m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
+        xButton->SetImageAlign(ImageAlign::Left); //default to left
+        setupFromActionName(xButton, rMap, m_xFrame);
+        xWindow = xButton;
+    }
     else if (name == "GtkToggleButton")
     {
         VclPtr<Button> xButton;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to