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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 1 11:13:36 UTC 2020


 vcl/source/window/builder.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 9b43115151f3f7a34377ad027450fd1afbb5f738
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jan 31 17:49:56 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Feb 1 12:12:56 2020 +0100

    support arbitrary widgets in toolbars via children of GtkToolItem
    
    Change-Id: I6dcc146ba3a55f263f71e29a17b5e75de2bbe130
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87784
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 400073bfda8a..154eaaccd974 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1782,6 +1782,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
     if (bIsPlaceHolder || name == "GtkTreeSelection")
         return nullptr;
 
+    ToolBox *pToolBox = (pParent && pParent->GetType() == WindowType::TOOLBOX) ? static_cast<ToolBox*>(pParent) : nullptr;
+
     extractButtonImage(id, rMap, name == "GtkRadioButton");
 
     VclPtr<vcl::Window> xWindow;
@@ -2316,9 +2318,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
         return nullptr;
     }
     else if (name == "GtkToolButton" || name == "GtkMenuToolButton" ||
-             name == "GtkToggleToolButton" || name == "GtkRadioToolButton")
+             name == "GtkToggleToolButton" || name == "GtkRadioToolButton" || name == "GtkToolItem")
     {
-        ToolBox *pToolBox = dynamic_cast<ToolBox*>(pParent);
         if (pToolBox)
         {
             OUString aCommand(extractActionName(rMap));
@@ -2366,7 +2367,6 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
     }
     else if (name == "GtkSeparatorToolItem")
     {
-        ToolBox *pToolBox = dynamic_cast<ToolBox*>(pParent);
         if (pToolBox)
         {
             pToolBox->InsertSeparator();
@@ -2407,6 +2407,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
             }
         }
     }
+
     SAL_INFO_IF(!xWindow, "vcl.layout", "probably need to implement " << name << " or add a make" << name << " function");
     if (xWindow)
     {
@@ -2422,6 +2423,13 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
             xWindow->ImplGetWindowImpl()->mpBorderWindow.get() << ") with helpid " <<
             xWindow->GetHelpId());
         m_aChildren.emplace_back(id, xWindow, bVertical);
+
+        // if the parent was a toolbox set it as an itemwindow for the latest itemid
+        if (pToolBox)
+        {
+            pToolBox->SetItemWindow(m_pParserState->m_nLastToolbarId, xWindow);
+            pToolBox->SetItemExpand(m_pParserState->m_nLastToolbarId, true);
+        }
     }
     return xWindow;
 }


More information about the Libreoffice-commits mailing list