tdf#38742 - Draw a separator line between the pinned/unpinned items
Change-Id: Ie67da6bc2113ca9922e8e3b2c6fe426a1ac6e5c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207722 Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Tested-by: Jenkins
This commit is contained in:
@@ -303,12 +303,15 @@ protected:
|
||||
tools::Long mnVItemSpace; // Vertical spacing between rows, -1 to use excess unused height split up between items
|
||||
tools::Long mnVisLines;
|
||||
tools::Long mnLines;
|
||||
tools::Long mnPinnedSeparatorY; // tdf#38742 - vertical position of the separator line between pinned/unpinned items
|
||||
tools::Long mnPinnedSeparatorMargin; // tdf#38742 - horizontal margin of the pinned separator
|
||||
|
||||
sal_uInt16 mnCols;
|
||||
sal_uInt16 mnFirstLine;
|
||||
bool mbScroll : 1; // Whether we need to scroll
|
||||
bool mbAllowVScrollBar : 1; // Whether to show a visible scrollbar
|
||||
bool mbHasVisibleItems : 1;
|
||||
bool mbHasPinnedSeparator : 1; // tdf#38742 - whether to draw a separator line after the pinned items
|
||||
bool mbShowTooltips : 1;
|
||||
bool mbDrawMnemonics : 1;
|
||||
bool mbSelectOnFocus : 1;
|
||||
|
||||
@@ -283,8 +283,11 @@ void ThumbnailView::ImplInit()
|
||||
mnLines = 0;
|
||||
mnFirstLine = 0;
|
||||
mnCols = 0;
|
||||
mnPinnedSeparatorY = 0;
|
||||
mnPinnedSeparatorMargin = 0;
|
||||
mbScroll = false;
|
||||
mbHasVisibleItems = false;
|
||||
mbHasPinnedSeparator = false;
|
||||
mbShowTooltips = false;
|
||||
mbDrawMnemonics = false;
|
||||
mbAllowMultiSelection = true;
|
||||
@@ -526,6 +529,16 @@ void ThumbnailView::CalculateItemPositions(bool bScrollBarUsed)
|
||||
y += mnItemHeight + nVItemSpace;
|
||||
}
|
||||
|
||||
// tdf#38742 - calculate the position for the separator line between pinned/unpinned items
|
||||
mbHasPinnedSeparator = nCurCountVisible && nItemCountPinned < nItemCount;
|
||||
if (mbHasPinnedSeparator)
|
||||
{
|
||||
// separator line is drawn at the center above the first unpinned row
|
||||
mnPinnedSeparatorY = y - nVItemSpace / 2;
|
||||
// separator line is aligned with the first and last document thumbnails in the row
|
||||
mnPinnedSeparatorMargin = nStartX;
|
||||
}
|
||||
|
||||
// tdf#164102 - adjust first item only if there are any pinned items
|
||||
if (const auto nRemainingPinnedSlots = nItemCountPinned % mnCols)
|
||||
{
|
||||
@@ -980,6 +993,16 @@ void ThumbnailView::Paint(vcl::RenderContext& rRenderContext, const ::tools::Rec
|
||||
continue;
|
||||
pItem->Paint(pProcessor.get(), *mpItemAttrs);
|
||||
}
|
||||
|
||||
// tdf#38742 - draw a separator line between the pinned/unpinned items using left/right margin
|
||||
if (mbHasPinnedSeparator)
|
||||
{
|
||||
rRenderContext.SetLineColor(
|
||||
rRenderContext.GetSettings().GetStyleSettings().GetSeparatorColor());
|
||||
rRenderContext.DrawLine(
|
||||
Point(mnPinnedSeparatorMargin, mnPinnedSeparatorY),
|
||||
Point(GetOutputSizePixel().Width() - mnPinnedSeparatorMargin, mnPinnedSeparatorY));
|
||||
}
|
||||
}
|
||||
|
||||
void ThumbnailView::GetFocus()
|
||||
|
||||
Reference in New Issue
Block a user