From 061c96df4557c6bbbab0fe220c5e1b020c986c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 16 Jan 2020 10:33:37 +0100 Subject: [PATCH] [escher] Add vertical borders to StackView --- escher/include/escher/stack_view.h | 3 ++- escher/src/stack_view.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/escher/include/escher/stack_view.h b/escher/include/escher/stack_view.h index ec3a5d649..213518fbf 100644 --- a/escher/include/escher/stack_view.h +++ b/escher/include/escher/stack_view.h @@ -1,10 +1,11 @@ #ifndef ESCHER_STACK_VIEW_H #define ESCHER_STACK_VIEW_H +#include #include #include -class StackView : public View { +class StackView : public View, public Bordered { public: StackView(); void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/escher/src/stack_view.cpp b/escher/src/stack_view.cpp index 97f1c783d..1ac9d43c3 100644 --- a/escher/src/stack_view.cpp +++ b/escher/src/stack_view.cpp @@ -30,13 +30,11 @@ void StackView::setNamedController(ViewController * controller) { } void StackView::drawRect(KDContext * ctx, KDRect rect) const { - const KDFont * font = KDFont::SmallFont; - KDCoordinate height = bounds().height(); - KDCoordinate width = bounds().width(); - ctx->fillRect(KDRect(0, 0, width, 1), m_separatorColor); - ctx->fillRect(KDRect(0, 1, width, height-2), m_backgroundColor); - ctx->fillRect(KDRect(0, height-1, width, 1), m_separatorColor); + KDRect b = bounds(); + drawBorderOfRect(ctx, b, m_separatorColor); + drawInnerRect(ctx, b, m_backgroundColor); // Write title + const KDFont * font = KDFont::SmallFont; KDSize textSize = font->stringSize(m_controller->title()); KDPoint origin((m_frame.width() - textSize.width())/2,(m_frame.height() - textSize.height())/2); ctx->drawString(m_controller->title(), origin, font, m_textColor, m_backgroundColor);