From 7adac7b110dc45c990b6125366394d2a66e527b9 Mon Sep 17 00:00:00 2001 From: Oliver Specht Date: Wed, 8 May 2002 09:12:37 +0000 Subject: #99041# resize split windows using Alt+KEY_UP/KEY_DOWN --- extensions/source/bibliography/bibcont.cxx | 38 +++++++++++++++++++++++++++--- extensions/source/bibliography/bibcont.hxx | 5 ++-- 2 files changed, 38 insertions(+), 5 deletions(-) (limited to 'extensions/source/bibliography') diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx index 4ec0da2e62af..ff3640bd84e6 100644 --- a/extensions/source/bibliography/bibcont.cxx +++ b/extensions/source/bibliography/bibcont.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bibcont.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: gt $ $Date: 2002-04-25 09:27:20 $ + * last change: $Author: os $ $Date: 2002-05-08 10:12:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,7 +97,9 @@ using namespace ::rtl; #define C2U(cChar) OUString::createFromAscii(cChar) #define PROPERTY_FRAME 1 - +//split window size is a percent value +#define WIN_MIN_HEIGHT 10 +#define WIN_STEP_SIZE 5 BibWindowContainer::BibWindowContainer( Window* pParent, WinBits nStyle ) : Window( pParent, nStyle ), @@ -382,3 +384,33 @@ void BibBookContainer::GetFocus() if( pBottomWin ) pBottomWin->GrabFocus(); } + +long BibBookContainer::PreNotify( NotifyEvent& rNEvt ) +{ + long nHandled = 0; + if( EVENT_KEYINPUT == rNEvt.GetType() ) + { + const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); + const KeyCode aKeyCode = pKEvt->GetKeyCode(); + USHORT nKey = aKeyCode.GetCode(); + const USHORT nModifier = aKeyCode.GetModifier(); + if(KEY_MOD2 == nModifier && + (KEY_UP == nKey || KEY_DOWN == nKey)) + { + if(pTopWin && pBottomWin) + { + USHORT nFirstWinId = KEY_UP == nKey ? TOP_WINDOW : BOTTOM_WINDOW; + USHORT nSecondWinId = KEY_UP == nKey ? BOTTOM_WINDOW : TOP_WINDOW; + long nHeight = GetItemSize( nFirstWinId ); + nHeight -= WIN_STEP_SIZE; + if(nHeight < WIN_MIN_HEIGHT) + nHeight = WIN_MIN_HEIGHT; + SetItemSize( nFirstWinId, nHeight ); + SetItemSize( nSecondWinId, 100 - nHeight ); + } + nHandled = 1; + } + } + return nHandled; +} + diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx index d0400cac7cc8..e68396c8725f 100644 --- a/extensions/source/bibliography/bibcont.hxx +++ b/extensions/source/bibliography/bibcont.hxx @@ -2,9 +2,9 @@ * * $RCSfile: bibcont.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: gt $ $Date: 2002-04-25 09:27:20 $ + * last change: $Author: os $ $Date: 2002-05-08 10:12:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -124,6 +124,7 @@ class BibBookContainer: public SplitWindow void CreateTopWin(); void CreateBottomWin(); + virtual long PreNotify( NotifyEvent& rNEvt ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetTopComponentInterface( sal_Bool bCreate = sal_True ); void SetTopComponentInterface( ::com::sun::star::awt::XWindowPeer* pIFace ); -- cgit v1.2.3