diff options
author | Simon Long <simon@raspberrypi.org> | 2015-07-08 18:02:50 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-09 15:07:24 +0000 |
commit | 74407aef94b6d8dfdd69891c4a6e578587ef3e71 (patch) | |
tree | cc8c8f9cde981f90760cb7fdaa02688713989f83 /vcl/source/window/dialog.cxx | |
parent | 40ade8d04380083e383d6a6e50e5c254fcde2b2f (diff) |
tdf#92630 Enable auto-accelerator behaviour for gtk
Change-Id: I671177dd1f9e535c28a29bcbd6b74f1c789371ea
Reviewed-on: https://gerrit.libreoffice.org/16883
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/window/dialog.cxx')
-rw-r--r-- | vcl/source/window/dialog.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index b6679d10189b..5f3acda65a3c 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -585,6 +585,31 @@ IMPL_LINK_NOARG(Dialog, ImplAsyncCloseHdl) return 0; } +bool Dialog::ImplHandleCmdEvent( const CommandEvent& rCEvent ) +{ + if (rCEvent.GetCommand() == CommandEventId::ModKeyChange) + { + const CommandModKeyData *pCData = rCEvent.GetModKeyData (); + + Window *pGetChild = firstLogicalChildOfParent(this); + while (pGetChild) + { + Control *pControl = dynamic_cast<Control*>(pGetChild->ImplGetWindow()); + if (pControl && pControl->GetText().indexOf('~') != -1) + { + if (pCData && pCData->IsMod2()) + pControl->SetShowAccelerator(true); + else + pControl->SetShowAccelerator(false); + pControl->Invalidate(InvalidateFlags::Update); + } + pGetChild = nextLogicalChildOfParent(this, pGetChild); + } + return true; + } + return false; +} + bool Dialog::Notify( NotifyEvent& rNEvt ) { // first call the base class due to Tab control @@ -628,6 +653,11 @@ bool Dialog::Notify( NotifyEvent& rNEvt ) } } + else if (rNEvt.GetType() == MouseNotifyEvent::COMMAND) + { + if (ImplHandleCmdEvent( *rNEvt.GetCommandEvent())) + return true; + } } return nRet; |