diff options
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/dialog.cxx | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index e8d8d477b1ff..1849b728ab42 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -42,6 +42,8 @@ #include <vcl/button.hxx> #include <vcl/mnemonic.hxx> #include <vcl/dialog.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabpage.hxx> #include <vcl/decoview.hxx> #include <vcl/msgbox.hxx> #include <vcl/unowrap.hxx> @@ -236,6 +238,16 @@ void ImplWindowAutoMnemonic( vcl::Window* pWindow ) } } +void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow ) +{ + Control *pControl = dynamic_cast<Control*>(pWindow->ImplGetWindow()); + if (pControl && pControl->GetText().indexOf('~') != -1) + { + pControl->SetShowAccelerator( bShow ); + pControl->Invalidate(InvalidateFlags::Update); + } +} + static VclButtonBox* getActionArea(Dialog *pDialog) { VclButtonBox *pButtonBox = nullptr; @@ -590,19 +602,27 @@ bool Dialog::ImplHandleCmdEvent( const CommandEvent& rCEvent ) if (rCEvent.GetCommand() == CommandEventId::ModKeyChange) { const CommandModKeyData *pCData = rCEvent.GetModKeyData (); + bool bShowAccel = pCData && pCData->IsMod2(); Window *pGetChild = firstLogicalChildOfParent(this); while (pGetChild) { - Control *pControl = dynamic_cast<Control*>(pGetChild->ImplGetWindow()); - if (pControl && pControl->GetText().indexOf('~') != -1) + if ( pGetChild->GetType() == WINDOW_TABCONTROL ) { - if (pCData && pCData->IsMod2()) - pControl->SetShowAccelerator(true); - else - pControl->SetShowAccelerator(false); - pControl->Invalidate(InvalidateFlags::Update); + // find currently shown tab page + TabControl* pTabControl = static_cast<TabControl*>( pGetChild ); + 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); + } } + + ImplHandleControlAccelerator( pGetChild, bShowAccel ); pGetChild = nextLogicalChildOfParent(this, pGetChild); } return true; |