summaryrefslogtreecommitdiff
path: root/vcl/source/control/ilstbox.cxx
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2010-01-26 16:43:42 +0100
committerIvo Hinkelmann <ihi@openoffice.org>2010-01-26 16:43:42 +0100
commit067e9b189b26900e0f3d064b134c9cea5865069d (patch)
tree8933377cca9e07430a2a0bd40fbd1c8099a7cadc /vcl/source/control/ilstbox.cxx
parent20c9b2305c7f9c2341961a1aa32bdc151aead3b4 (diff)
parent432e0fcb93c713a39890ec7ed0769521ef6ef3e8 (diff)
CWS-TOOLING: integrate CWS vcl108
Diffstat (limited to 'vcl/source/control/ilstbox.cxx')
-rw-r--r--vcl/source/control/ilstbox.cxx27
1 files changed, 19 insertions, 8 deletions
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index fd5cd7ae4dac..ab353a4d4798 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -565,6 +565,7 @@ ImplListBoxWindow::ImplListBoxWindow( Window* pParent, WinBits nWinStyle ) :
mnCurrentPos = LISTBOX_ENTRY_NOTFOUND;
mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND;
mnSeparatorPos = LISTBOX_ENTRY_NOTFOUND;
+ meProminentType = PROMINENT_TOP;
SetLineColor();
SetTextFillColor();
@@ -1067,11 +1068,11 @@ void ImplListBoxWindow::SelectEntry( USHORT nPos, BOOL bSelect )
if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) )
{
Resize();
- SetTopEntry( nPos );
+ ShowProminentEntry( nPos );
}
else
{
- SetTopEntry( nPos-nVisibleEntries+1 );
+ ShowProminentEntry( nPos );
}
}
}
@@ -1702,11 +1703,7 @@ BOOL ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt )
if ( nSelect != LISTBOX_ENTRY_NOTFOUND )
{
- USHORT nCurVis = GetLastVisibleEntry() - mnTop + 1;
- if( nSelect < mnTop )
- SetTopEntry( nSelect );
- else if( nSelect >= (mnTop + nCurVis) )
- SetTopEntry( nSelect - nCurVis + 1 );
+ ShowProminentEntry( nSelect );
if ( mpEntryList->IsEntryPosSelected( nSelect ) )
nSelect = LISTBOX_ENTRY_NOTFOUND;
@@ -2053,6 +2050,20 @@ void ImplListBoxWindow::SetTopEntry( USHORT nTop )
// -----------------------------------------------------------------------
+void ImplListBoxWindow::ShowProminentEntry( USHORT nEntryPos )
+{
+ if( meProminentType == PROMINENT_MIDDLE )
+ {
+ USHORT nPos = nEntryPos;
+ long nWHeight = PixelToLogic( GetSizePixel() ).Height();
+ while( nEntryPos > 0 && mpEntryList->GetAddedHeight( nPos+1, nEntryPos ) < nWHeight/2 )
+ nEntryPos--;
+ }
+ SetTopEntry( nEntryPos );
+}
+
+// -----------------------------------------------------------------------
+
void ImplListBoxWindow::SetLeftIndent( long n )
{
ScrollHorz( n - mnLeft );
@@ -3206,7 +3217,7 @@ void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking )
StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN );
if( nPos != LISTBOX_ENTRY_NOTFOUND )
- mpImplLB->SetTopEntry( nPos );
+ mpImplLB->ShowProminentEntry( nPos );
if( bStartTracking )
mpImplLB->GetMainWindow()->EnableMouseMoveSelect( TRUE );