diff options
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 1 | ||||
-rw-r--r-- | vcl/inc/vcl/combobox.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/vcl/ilstbox.hxx | 10 | ||||
-rw-r--r-- | vcl/inc/vcl/lstbox.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/vcl/wintypes.hxx | 6 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 24 | ||||
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 27 | ||||
-rw-r--r-- | vcl/source/control/lstbox.cxx | 21 |
8 files changed, 87 insertions, 10 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 097bba0e39f9..b4d8d0506917 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1152,6 +1152,7 @@ void FontSizeBox::ImplInit() SetDecimalDigits( 1 ); SetMin( 20 ); SetMax( 9999 ); + SetProminentEntryType( PROMINENT_MIDDLE ); } // ----------------------------------------------------------------------- diff --git a/vcl/inc/vcl/combobox.hxx b/vcl/inc/vcl/combobox.hxx index d57d4b8a7372..cbceffaff6c0 100644 --- a/vcl/inc/vcl/combobox.hxx +++ b/vcl/inc/vcl/combobox.hxx @@ -192,8 +192,12 @@ public: void* GetEntryData( USHORT nPos ) const; void SetTopEntry( USHORT nPos ); + void ShowProminentEntry( USHORT nPos ); USHORT GetTopEntry() const; + void SetProminentEntryType( ProminentEntry eType ); + ProminentEntry GetProminentEntryType() const; + USHORT GetDisplayLineCount() const; USHORT GetSelectEntryCount() const; diff --git a/vcl/inc/vcl/ilstbox.hxx b/vcl/inc/vcl/ilstbox.hxx index 81dd32ef2705..f38825028080 100644 --- a/vcl/inc/vcl/ilstbox.hxx +++ b/vcl/inc/vcl/ilstbox.hxx @@ -227,6 +227,7 @@ private: long mnLeft; // Ausgabe ab Spalte long mnBorder; // Abstand Rahmen - Text long mnTextHeight; // Texthoehe + ProminentEntry meProminentType; // where is the "prominent" entry USHORT mnSelectModifier; // Modifiers @@ -309,6 +310,11 @@ public: void SetTopEntry( USHORT nTop ); USHORT GetTopEntry() const { return mnTop; } + // ShowProminentEntry will set the entry correspoding to nEntryPos + // either at top or in the middle depending on the chosen style + void ShowProminentEntry( USHORT nEntryPos ); + void SetProminentEntryType( ProminentEntry eType ) { meProminentType = eType; } + ProminentEntry GetProminentEntryType() const { return meProminentType; } using Window::IsVisible; BOOL IsVisible( USHORT nEntry ) const; @@ -443,9 +449,13 @@ public: void SetTopEntry( USHORT nTop ) { maLBWindow.SetTopEntry( nTop ); } USHORT GetTopEntry() const { return maLBWindow.GetTopEntry(); } + void ShowProminentEntry( USHORT nPos ) { maLBWindow.ShowProminentEntry( nPos ); } using Window::IsVisible; BOOL IsVisible( USHORT nEntry ) const { return maLBWindow.IsVisible( nEntry ); } + void SetProminentEntryType( ProminentEntry eType ) { maLBWindow.SetProminentEntryType( eType ); } + ProminentEntry GetProminentEntryType() const { return maLBWindow.GetProminentEntryType(); } + long GetLeftIndent() const { return maLBWindow.GetLeftIndent(); } void SetLeftIndent( USHORT n ) { maLBWindow.SetLeftIndent( n ); } void ScrollHorz( short nDiff ) { maLBWindow.ScrollHorz( nDiff ); } diff --git a/vcl/inc/vcl/lstbox.hxx b/vcl/inc/vcl/lstbox.hxx index 0bf281798674..806ff9bb3e0f 100644 --- a/vcl/inc/vcl/lstbox.hxx +++ b/vcl/inc/vcl/lstbox.hxx @@ -168,9 +168,13 @@ public: long GetEntryFlags( USHORT nPos ) const; void SetTopEntry( USHORT nPos ); + void ShowProminentEntry( USHORT nPos ); void SetTopEntryStr( const XubString& rStr ); USHORT GetTopEntry() const; + void SetProminentEntryType( ProminentEntry eType ); + ProminentEntry GetProminentEntryType() const; + void SaveValue() { mnSaveValue = GetSelectEntryPos(); } USHORT GetSavedValue() const { return mnSaveValue; } diff --git a/vcl/inc/vcl/wintypes.hxx b/vcl/inc/vcl/wintypes.hxx index 968f0e1d255f..1c32001a649b 100644 --- a/vcl/inc/vcl/wintypes.hxx +++ b/vcl/inc/vcl/wintypes.hxx @@ -333,5 +333,11 @@ typedef USHORT StandardButtonType; #define BUTTON_LESS ((StandardButtonType)10) #define BUTTON_COUNT 11 +// -------------------------------------------- +// - prominent place for ListBox window types - +// -------------------------------------------- + +enum ProminentEntry { PROMINENT_TOP, PROMINENT_MIDDLE }; + #endif // _SV_WINTYPES_HXX diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 21707d0182f5..1eea72131b86 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -951,7 +951,7 @@ void ComboBox::ImplUpdateFloatSelection() if( nSelect != LISTBOX_ENTRY_NOTFOUND ) { if ( !mpImplLB->IsVisible( nSelect ) ) - mpImplLB->SetTopEntry( nSelect ); + mpImplLB->ShowProminentEntry( nSelect ); mpImplLB->SelectEntry( nSelect, bSelect ); } else @@ -959,7 +959,6 @@ void ComboBox::ImplUpdateFloatSelection() nSelect = mpImplLB->GetEntryList()->GetSelectEntryPos( 0 ); if( nSelect != LISTBOX_ENTRY_NOTFOUND ) mpImplLB->SelectEntry( nSelect, FALSE ); - // mpImplLB->SetTopEntry( 0 ); #92555# Ugly.... mpImplLB->ResetCurrentPos(); } } @@ -1440,6 +1439,13 @@ void ComboBox::SetTopEntry( USHORT nPos ) // ----------------------------------------------------------------------- +void ComboBox::ShowProminentEntry( USHORT nPos ) +{ + mpImplLB->ShowProminentEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); +} + +// ----------------------------------------------------------------------- + USHORT ComboBox::GetTopEntry() const { USHORT nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND; @@ -1450,6 +1456,20 @@ USHORT ComboBox::GetTopEntry() const // ----------------------------------------------------------------------- +void ComboBox::SetProminentEntryType( ProminentEntry eType ) +{ + mpImplLB->SetProminentEntryType( eType ); +} + +// ----------------------------------------------------------------------- + +ProminentEntry ComboBox::GetProminentEntryType() const +{ + return mpImplLB->GetProminentEntryType(); +} + +// ----------------------------------------------------------------------- + Rectangle ComboBox::GetDropDownPosSizePixel() const { return mpFloatWin ? mpFloatWin->GetWindowExtentsRelative( const_cast<ComboBox*>(this) ) : Rectangle(); diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index a915d8e6b9e8..490651bd8b17 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; @@ -2051,6 +2048,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 ); @@ -3204,7 +3215,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 ); diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index ceabbe4ab166..37ce438fa79e 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -1209,6 +1209,13 @@ void ListBox::SetTopEntry( USHORT nPos ) // ----------------------------------------------------------------------- +void ListBox::ShowProminentEntry( USHORT nPos ) +{ + mpImplLB->ShowProminentEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount() ); +} + +// ----------------------------------------------------------------------- + USHORT ListBox::GetTopEntry() const { USHORT nPos = GetEntryCount() ? mpImplLB->GetTopEntry() : LISTBOX_ENTRY_NOTFOUND; @@ -1219,6 +1226,20 @@ USHORT ListBox::GetTopEntry() const // ----------------------------------------------------------------------- +void ListBox::SetProminentEntryType( ProminentEntry eType ) +{ + mpImplLB->SetProminentEntryType( eType ); +} + +// ----------------------------------------------------------------------- + +ProminentEntry ListBox::GetProminentEntryType() const +{ + return mpImplLB->GetProminentEntryType(); +} + +// ----------------------------------------------------------------------- + BOOL ListBox::IsTravelSelect() const { return mpImplLB->IsTravelSelect(); |