Kaydet (Commit) 97932839 authored tarafından Caolán McNamara's avatar Caolán McNamara

add GtkMenuButton support

Change-Id: Id5cda4775e405ed708de09ee1332cd84461b265d
Reviewed-on: https://gerrit.libreoffice.org/52669Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 9e6ee59a
...@@ -602,6 +602,18 @@ namespace ...@@ -602,6 +602,18 @@ namespace
return bDrawValue; 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 extractValuePos(VclBuilder::stringmap& rMap)
{ {
OUString sRet("top"); OUString sRet("top");
...@@ -1393,6 +1405,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & ...@@ -1393,6 +1405,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
xButton = extractStockAndBuildPushButton(pParent, rMap, m_bLegacy); xButton = extractStockAndBuildPushButton(pParent, rMap, m_bLegacy);
else else
{ {
assert(m_bLegacy && "use GtkMenuButton");
xButton = extractStockAndBuildMenuButton(pParent, rMap); xButton = extractStockAndBuildMenuButton(pParent, rMap);
m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu); m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
} }
...@@ -1400,6 +1413,17 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & ...@@ -1400,6 +1413,17 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
setupFromActionName(xButton, rMap, m_xFrame); setupFromActionName(xButton, rMap, m_xFrame);
xWindow = xButton; 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") else if (name == "GtkToggleButton")
{ {
VclPtr<Button> xButton; VclPtr<Button> xButton;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment