Horizontal scrollbars

This commit is contained in:
Bertrand Songis
2020-11-12 17:40:17 +01:00
parent e5fa0eb078
commit 590e926b95
2 changed files with 15 additions and 0 deletions
+13
View File
@@ -483,3 +483,16 @@ void Window::drawVerticalScrollbar(BitmapBuffer * dc)
dc->drawSolidFilledRect(rect.w - SCROLLBAR_WIDTH, scrollPositionY + yofs, SCROLLBAR_WIDTH, yhgt, SCROLLBAR_COLOR);
}
}
void Window::drawHorizontalScrollbar(BitmapBuffer * dc)
{
if (innerWidth > rect.w) {
coord_t xofs = divRoundClosest(rect.w * scrollPositionX, innerWidth);
coord_t xwdth = divRoundClosest(rect.w * rect.w, innerWidth);
if (xwdth < 15)
xwdth = 15;
if (xwdth + xofs > rect.w)
xwdth = rect.w - xofs;
dc->drawSolidFilledRect(scrollPositionX + xofs, rect.h - SCROLLBAR_WIDTH, xwdth, SCROLLBAR_WIDTH, SCROLLBAR_COLOR);
}
}
+2
View File
@@ -329,6 +329,8 @@ class Window
void drawVerticalScrollbar(BitmapBuffer * dc);
void drawHorizontalScrollbar(BitmapBuffer * dc);
virtual void onEvent(event_t event);
void adjustInnerHeight();