summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-01-31 17:49:56 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-01 12:12:56 +0100
commit9b43115151f3f7a34377ad027450fd1afbb5f738 (patch)
treee65af8ae548793f60d16892dd0a242b9c417af1d
parentfa1b12c4ce1963086c30bef222a5238485bb2219 (diff)
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@redhat.com>
-rw-r--r--vcl/source/window/builder.cxx14
1 files changed, 11 insertions, 3 deletions
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;
}