[Libreoffice-commits] core.git: vcl/source
Caolán McNamara
caolanm at redhat.com
Tue Apr 10 13:23:39 UTC 2018
vcl/source/window/builder.cxx | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
New commits:
commit 97932839851ff4084f32c82442176c2114763b74
Author: Caolán McNamara <caolanm at 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 <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at 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;
More information about the Libreoffice-commits
mailing list