summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-10-03 12:49:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-10-03 12:51:27 +0100
commit348dcf1edb1a45027b52ba1e6f15bbf4d484a2c5 (patch)
treec2115806442902e767dd7866a623b56eccacbfaf
parent1bceb4e6aeaea138fac5ea9b3dfb8710babb3d43 (diff)
Resolves: tdf#99324 accel underlines don't appear in extension option pages
because they are not widget-layout tab pages, we have to dive down through the WB_DIALOGCONTROL widgets as well Change-Id: I13dbf88878efd89794158ce43137381008e18890
-rw-r--r--vcl/source/window/syswin.cxx59
1 files changed, 30 insertions, 29 deletions
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index cb45ea4bd56e..7526fa914baf 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -128,46 +128,47 @@ void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow )
}
}
-bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::Window *pWindow)
+namespace
{
- if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+ void processChildren(vcl::Window *pParent, bool bShowAccel)
{
- const CommandModKeyData *pCData = rCEvent.GetModKeyData();
- const bool bShowAccel = pCData && pCData->IsMod2();
-
- vcl::Window *pGetChild = firstLogicalChildOfParent(pWindow);
- while (pGetChild)
+ // go through its children
+ vcl::Window* pChild = firstLogicalChildOfParent(pParent);
+ while (pChild)
{
- if (pGetChild->GetType() == WINDOW_TABCONTROL)
+ if (pChild->GetType() == WINDOW_TABCONTROL)
{
// find currently shown tab page
- TabControl* pTabControl = static_cast<TabControl*>( pGetChild );
+ TabControl* pTabControl = static_cast<TabControl*>(pChild);
TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
- vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage );
-
- // and go through its children
- while ( pTabPageChild )
- {
- ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
- pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild);
- }
+ processChildren(pTabPage, bShowAccel);
}
- else if (pGetChild->GetType() == WINDOW_TABPAGE)
+ else if (pChild->GetType() == WINDOW_TABPAGE)
{
// bare tabpage without tabcontrol parent (options dialog)
- vcl::Window* pTabPageChild = firstLogicalChildOfParent( pGetChild );
-
- // and go through its children
- while ( pTabPageChild )
- {
- ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
- pTabPageChild = nextLogicalChildOfParent(pGetChild, pTabPageChild);
- }
+ processChildren(pChild, bShowAccel);
}
-
- ImplHandleControlAccelerator( pGetChild, bShowAccel );
- pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
+ else if ((pChild->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL)
+ {
+ // special controls that manage their children outside of widget layout
+ processChildren(pChild, bShowAccel);
+ }
+ else
+ {
+ ImplHandleControlAccelerator(pChild, bShowAccel);
+ }
+ pChild = nextLogicalChildOfParent(pParent, pChild);
}
+ }
+}
+
+bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::Window *pWindow)
+{
+ if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+ {
+ const CommandModKeyData *pCData = rCEvent.GetModKeyData();
+ const bool bShowAccel = pCData && pCData->IsMod2();
+ processChildren(pWindow, bShowAccel);
return true;
}
return false;