diff --git a/lib/widget/scrollablelist.cpp b/lib/widget/scrollablelist.cpp index 8cc8d568c09..1456f8e2b63 100644 --- a/lib/widget/scrollablelist.cpp +++ b/lib/widget/scrollablelist.cpp @@ -34,6 +34,7 @@ void ScrollableListWidget::initialize() scrollBar->show(false); scrollbarWidth = SCROLLBAR_WIDTH; backgroundColor.rgba = 0; + borderColor.rgba = 0; } void ScrollableListWidget::geometryChanged() @@ -196,6 +197,11 @@ void ScrollableListWidget::setBackgroundColor(PIELIGHT const &color) backgroundColor = color; } +void ScrollableListWidget::setBorderColor(PIELIGHT const &color) +{ + borderColor = color; +} + void ScrollableListWidget::setSnapOffset(bool value) { snapOffset = value; @@ -213,12 +219,20 @@ void ScrollableListWidget::setItemSpacing(uint32_t value) void ScrollableListWidget::display(int xOffset, int yOffset) { + int x0 = x() + xOffset; + int y0 = y() + yOffset; + if (backgroundColor.rgba != 0) { - int x0 = x() + xOffset; - int y0 = y() + yOffset; pie_UniTransBoxFill(x0, y0, x0 + width(), y0 + height(), backgroundColor); } + + if (borderColor.rgba != 0) + { + int x1 = x0 + width(); + int y1 = y0 + height(); + iV_Box(x0, y0, x1, y1, borderColor); + } } void ScrollableListWidget::displayRecursive(WidgetGraphicsContext const& context) diff --git a/lib/widget/scrollablelist.h b/lib/widget/scrollablelist.h index 1ecd1a268ad..078f4ba09fc 100644 --- a/lib/widget/scrollablelist.h +++ b/lib/widget/scrollablelist.h @@ -54,6 +54,7 @@ class ScrollableListWidget : public WIDGET void setPadding(Padding const &rect); void setSnapOffset(bool value); void setBackgroundColor(PIELIGHT const &color); + void setBorderColor(PIELIGHT const &color); void setItemSpacing(uint32_t value); uint32_t getItemSpacing() const { return itemSpacing; } uint32_t calculateListViewHeight() const; @@ -84,6 +85,7 @@ class ScrollableListWidget : public WIDGET bool layoutDirty = false; Padding padding = {0, 0, 0, 0}; PIELIGHT backgroundColor; + PIELIGHT borderColor; uint32_t itemSpacing = 0; int scrollbarWidth = 0; bool expandWidthWhenScrollbarInvisible = true;