diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-17 15:29:55 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-17 15:34:09 +0000 |
commit | b64bdb8d75105d08fff11beca4bbba128d214d5e (patch) | |
tree | 100bcbb84fcbe7565318a2233bb17bbe5f897c43 /vcl/source/window | |
parent | fbaec92d4366caa35e2db8fdb60d8f3976453b65 (diff) |
support submenu entries of menus in vcl builder
Change-Id: Ia6f80871ccf56527bb1338a288554bc37cd699e2
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/builder.cxx | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index ac2d86947345..709c51e9093b 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -2592,6 +2592,8 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read if (!sCustomProperty.isEmpty()) aProperties[OString("customproperty")] = sCustomProperty; + bool bInserted = false; + while(true) { xmlreader::XmlReader::Result res = reader.nextItem( @@ -2602,11 +2604,22 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read if (res == xmlreader::XmlReader::Result::Begin) { - ++nLevel; - if (name.equals("property")) - collectProperty(reader, sID, aProperties); - else if (name.equals("accelerator")) - collectAccelerator(reader, aAccelerators); + if (name.equals("child")) + { + insertMenuObject(pParent, sClass, sID, aProperties, aAccelerators); + VclPtr<PopupMenu> xSubMenu = VclPtr<PopupMenu>::Create(); + pParent->SetPopupMenu(pParent->GetItemCount(), xSubMenu); + handleMenuChild(xSubMenu, reader); + bInserted = true; + } + else + { + ++nLevel; + if (name.equals("property")) + collectProperty(reader, sID, aProperties); + else if (name.equals("accelerator")) + collectAccelerator(reader, aAccelerators); + } } if (res == xmlreader::XmlReader::Result::End) @@ -2618,6 +2631,9 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read break; } + if (bInserted) + return; + insertMenuObject(pParent, sClass, sID, aProperties, aAccelerators); } @@ -2722,6 +2738,9 @@ namespace void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, const OString &rID, stringmap &rProps, accelmap &rAccels) { + if (rClass == "GtkMenu") + return; + sal_uInt16 nOldCount = pParent->GetItemCount(); sal_uInt16 nNewId = nOldCount + 1; @@ -2746,7 +2765,6 @@ void VclBuilder::insertMenuObject(PopupMenu *pParent, const OString &rClass, con pParent->InsertItem(nNewId, sLabel, MenuItemBits::CHECKABLE | MenuItemBits::RADIOCHECK, rID); pParent->SetItemCommand(nNewId, aCommand); } - else if (rClass == "GtkSeparatorMenuItem") { pParent->InsertSeparator(rID); |