summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2016-01-19 23:07:47 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2016-01-21 14:40:09 +0000
commit39471da6e4d016c52c6cdf6553d7418416a160f4 (patch)
tree285280e63b96fcf2066f1c56249a7fc0326c16ba /vcl/source
parente7eca35148204d094dcdb7d8b3e4ec6c9d454159 (diff)
tdf#95587: Make rectangle control within tab pages work again
Since commit 74407aef94b6d8dfdd6, tab pages|controls are considered to be container widgets (thus, search for the nearest non-layout parent will never find a tab page parent, breaking rectangle control in many dialogs). I've no idea how many other functions' behaviour this changes in an unexpected way, so I've reverted that bit. That however means implementing slightly different approach to tdf#92630 in dialogs (for a tab dialog, find current tab page and go through its children) Change-Id: I3ff5ac13f04b1c5c799c7a1a3769108927809f31 Reviewed-on: https://gerrit.libreoffice.org/21615 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/window/dialog.cxx34
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;