diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-10 12:45:56 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-10 15:23:17 +0200 |
commit | 97932839851ff4084f32c82442176c2114763b74 (patch) | |
tree | c379356ece62b131ace3706cfd03707c6353720a | |
parent | 9e6ee59a0f6e2c7276d6683e6a233298536f5b14 (diff) |
add GtkMenuButton support
Change-Id: Id5cda4775e405ed708de09ee1332cd84461b265d
Reviewed-on: https://gerrit.libreoffice.org/52669
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/window/builder.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
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; |