diff options
author | Stephan Schäfer <ssa@openoffice.org> | 2002-02-22 08:09:23 +0000 |
---|---|---|
committer | Stephan Schäfer <ssa@openoffice.org> | 2002-02-22 08:09:23 +0000 |
commit | 2c1033cefe2be7278fd0fe17b8fe3819c7107a81 (patch) | |
tree | e933f1d404cc1a26615e811fe04236465c5f6d8e | |
parent | bbff0af7a6063be157e988c2a739eafaece5725e (diff) |
#96983# cycle through toolboxes/menubar
-rw-r--r-- | vcl/source/window/menu.cxx | 51 | ||||
-rw-r--r-- | vcl/source/window/syswin.cxx | 56 |
2 files changed, 96 insertions, 11 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index d76756648ef8..faff8b0a76b6 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2,9 +2,9 @@ * * $RCSfile: menu.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: ssa $ $Date: 2002-02-06 14:32:38 $ + * last change: $Author: ssa $ $Date: 2002-02-22 09:08:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,7 +128,9 @@ #ifndef _ISOLANG_HXX #include <tools/isolang.hxx> #endif - +#ifndef _SV_TASKPANELIST_HXX +#include <taskpanelist.hxx> +#endif #pragma hdrstop #ifndef _COM_SUN_STAR_UNO_REFERENCE_H_ @@ -438,6 +440,7 @@ private: void StateChanged( StateChangedType nType ); void DataChanged( const DataChangedEvent& rDCEvt ); void LoseFocus(); + void GetFocus(); public: MenuBarWindow( Window* pParent ); @@ -3393,7 +3396,23 @@ void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllo { ImplGetSVData()->maWinData.mbNoDeactivate = TRUE; if( !bStayActive ) - nSaveFocusId = Window::SaveFocus(); // only save focus when initially activated + { + if( nSaveFocusId ) + { + if( !ImplGetSVData()->maWinData.mbNoSaveFocus ) + { + // we didn't clean up last time + Window::EndSaveFocus( nSaveFocusId, FALSE ); // clean up + nSaveFocusId = Window::SaveFocus(); // only save focus when initially activated + } + else + ; // do nothing: we 're activated again from taskpanelist, focus was already saved + } + else + { + nSaveFocusId = Window::SaveFocus(); // only save focus when initially activated + } + } else bStayActive = FALSE; pMenu->bInCallback = TRUE; // hier schon setzen, falls Activate ueberladen @@ -3406,10 +3425,13 @@ void MenuBarWindow::ChangeHighlightItem( USHORT n, BOOL bSelectEntry, BOOL bAllo pMenu->bInCallback = TRUE; pMenu->Deactivate(); pMenu->bInCallback = FALSE; - ULONG nTempFocusId = nSaveFocusId; - nSaveFocusId = 0; ImplGetSVData()->maWinData.mbNoDeactivate = FALSE; - Window::EndSaveFocus( nTempFocusId, bAllowRestoreFocus ); + if( !ImplGetSVData()->maWinData.mbNoSaveFocus ) + { + ULONG nTempFocusId = nSaveFocusId; + nSaveFocusId = 0; + Window::EndSaveFocus( nTempFocusId, bAllowRestoreFocus ); + } } if ( nHighlightedItem != ITEMPOS_INVALID ) @@ -3467,6 +3489,15 @@ BOOL MenuBarWindow::ImplHandleKeyEvent( const KeyEvent& rKEvent, BOOL bFromMenu BOOL bDone = FALSE; USHORT nCode = rKEvent.GetKeyCode().GetCode(); + + if( GetParent() ) + { + SystemWindow *pSysWin = (SystemWindow*)GetParent()->GetWindow( WINDOW_CLIENT ); + if( pSysWin->IsSystemWindow() && pSysWin->GetTaskPaneList() ) + if( pSysWin->GetTaskPaneList()->HandleKeyEvent( rKEvent ) ) + return TRUE; + } + if ( nCode == KEY_MENU ) { mbAutoPopup = FALSE; @@ -3736,3 +3767,9 @@ void MenuBarWindow::LoseFocus() if ( !HasChildPathFocus( TRUE ) ) ChangeHighlightItem( ITEMPOS_INVALID, FALSE, FALSE ); } + +void MenuBarWindow::GetFocus() +{ + if ( nHighlightedItem == ITEMPOS_INVALID ) + ChangeHighlightItem( 0, FALSE ); +} diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index ad135687cb42..4fb4630cf27e 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -2,9 +2,9 @@ * * $RCSfile: syswin.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: ssa $ $Date: 2002-02-15 08:38:55 $ + * last change: $Author: ssa $ $Date: 2002-02-22 09:09:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -107,7 +107,9 @@ #ifndef _SV_SYSWIN_HXX #include <syswin.hxx> #endif - +#ifndef _SV_TASKPANELIST_HXX +#include <taskpanelist.hxx> +#endif #include <unowrap.hxx> #ifdef REMOTE_APPSERVER @@ -136,6 +138,7 @@ SystemWindow::SystemWindow( WindowType nType ) : mbSysChild = FALSE; mnMenuBarMode = MENUBAR_MODE_NORMAL; mnIcon = 0; + mpTaskPaneList = NULL; } // ----------------------------------------------------------------------- @@ -163,11 +166,38 @@ long SystemWindow::Notify( NotifyEvent& rNEvt ) long SystemWindow::PreNotify( NotifyEvent& rNEvt ) { + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + if( mpTaskPaneList && mpTaskPaneList->HandleKeyEvent( *rNEvt.GetKeyEvent() ) ) + return TRUE; + } return Window::PreNotify( rNEvt ); } // ----------------------------------------------------------------------- +TaskPaneList* SystemWindow::GetTaskPaneList() +{ + if( mpTaskPaneList ) + return mpTaskPaneList ; + else + { + mpTaskPaneList = new TaskPaneList(); + MenuBar* pMBar = mpMenuBar; + if ( !pMBar && ( GetType() == WINDOW_FLOATINGWINDOW ) ) + { + SystemWindow* pW = (SystemWindow*)ImplGetFrameWindow()->ImplGetWindow(); + if ( pW ) + pMBar = pW->GetMenuBar(); + } + if( pMBar ) + mpTaskPaneList->AddWindow( pMBar->ImplGetWindow() ); + return mpTaskPaneList; + } +} + +// ----------------------------------------------------------------------- + BOOL SystemWindow::Close() { ImplDelData aDelData; @@ -698,6 +728,7 @@ void SystemWindow::SetMenuBar( MenuBar* pMenuBar ) { MenuBar* pOldMenuBar = mpMenuBar; Window* pOldWindow; + Window* pNewWindow=NULL; mpMenuBar = pMenuBar; if ( mpBorderWindow && (mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) ) @@ -709,13 +740,30 @@ void SystemWindow::SetMenuBar( MenuBar* pMenuBar ) if ( pMenuBar ) { DBG_ASSERT( !pMenuBar->pWindow, "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" ); - ((ImplBorderWindow*)mpBorderWindow)->SetMenuBarWindow( MenuBar::ImplCreate( mpBorderWindow, pOldWindow, pMenuBar ) ); + ((ImplBorderWindow*)mpBorderWindow)->SetMenuBarWindow( pNewWindow = MenuBar::ImplCreate( mpBorderWindow, pOldWindow, pMenuBar ) ); } else ((ImplBorderWindow*)mpBorderWindow)->SetMenuBarWindow( NULL ); ImplToBottomChild(); if ( pOldMenuBar ) MenuBar::ImplDestroy( pOldMenuBar, pMenuBar == 0 ); + + } + else + { + if( pMenuBar ) + pNewWindow = pMenuBar->ImplGetWindow(); + if( pOldMenuBar ) + pOldWindow = pOldMenuBar->ImplGetWindow(); + } + + // update taskpane list to make menubar accessible + if( mpTaskPaneList ) + { + if( pOldWindow ) + mpTaskPaneList->RemoveWindow( pOldWindow ); + if( pNewWindow ) + mpTaskPaneList->AddWindow( pNewWindow ); } Application::GenerateAccessEvent( ACCESS_EVENT_MENUBAR ); |