diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2018-04-19 21:36:08 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2018-04-20 20:52:35 +0200 |
commit | e9c52f55f0cc7155d6883e4d2abf14f1638b03b3 (patch) | |
tree | 4daa3ba03e39cde571f1220dfa231d430b5c7ec5 /vcl/source/control | |
parent | f1451fb7742bba9da298027e3ab79390acb196d9 (diff) |
towards solving tdf#112323: Allow multiple separators in listboxes
Change-Id: I40e2d9faa4121ad99e28cbae0d8eea8e46bc1e9a
Reviewed-on: https://gerrit.libreoffice.org/53174
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Muhammet Kara <muhammet.kara@pardus.org.tr>
Diffstat (limited to 'vcl/source/control')
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 29 | ||||
-rw-r--r-- | vcl/source/control/listbox.cxx | 5 |
2 files changed, 30 insertions, 4 deletions
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 171b75afd151..7dbabad9934a 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -491,7 +491,6 @@ ImplListBoxWindow::ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle ) mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; mnTrackingSaveSelection = LISTBOX_ENTRY_NOTFOUND; - mnSeparatorPos = LISTBOX_ENTRY_NOTFOUND; meProminentType = ProminentEntry::TOP; SetLineColor(); @@ -1825,13 +1824,12 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 } } - if ((mnSeparatorPos != LISTBOX_ENTRY_NOTFOUND) && - ((nPos == mnSeparatorPos) || (nPos == mnSeparatorPos + 1))) + if ( !maSeparators.empty() && ( isSeparator(nPos) || isSeparator(nPos-1) ) ) { Color aOldLineColor(rRenderContext.GetLineColor()); rRenderContext.SetLineColor((GetBackground().GetColor() != COL_LIGHTGRAY) ? COL_LIGHTGRAY : COL_GRAY); Point aStartPos(0, nY); - if (nPos == mnSeparatorPos) + if (isSeparator(nPos)) aStartPos.AdjustY(pEntry->mnHeight - 1 ); Point aEndPos(aStartPos); aEndPos.setX( GetOutputSizePixel().Width() ); @@ -2011,6 +2009,29 @@ void ImplListBoxWindow::ScrollHorz( long n ) } } +void ImplListBoxWindow::SetSeparatorPos( sal_Int32 n ) +{ + maSeparators.clear(); + + if ( n != LISTBOX_ENTRY_NOTFOUND ) + { + maSeparators.insert( n ); + } +} + +sal_Int32 ImplListBoxWindow::GetSeparatorPos() const +{ + if (!maSeparators.empty()) + return *(maSeparators.begin()); + else + return LISTBOX_ENTRY_NOTFOUND; +} + +bool ImplListBoxWindow::isSeparator( const sal_Int32 &n) const +{ + return maSeparators.find(n) != maSeparators.end(); +} + Size ImplListBoxWindow::CalcSize(sal_Int32 nMaxLines) const { // FIXME: ListBoxEntryFlags::MultiLine diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index ef945a087659..1d8e256e80e2 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -1380,6 +1380,11 @@ sal_Int32 ListBox::GetSeparatorPos() const return mpImplLB->GetSeparatorPos(); } +void ListBox::AddSeparator( sal_Int32 n ) +{ + mpImplLB->AddSeparator( n ); +} + sal_uInt16 ListBox::GetDisplayLineCount() const { return mpImplLB->GetDisplayLineCount(); |