From 91dd708476bd7cafb4ca0a16972bbc0316dc44b9 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Wed, 14 Aug 2013 12:56:15 +0200 Subject: [PATCH] Added method GMenu2X::getContentArea() --- src/gmenu2x.cpp | 15 +++++++++------ src/gmenu2x.h | 9 +++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index 8965e79..51222fa 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1195,16 +1195,19 @@ void GMenu2X::drawScrollBar(uint pageSize, uint totalSize, uint pagePos) { return; } - const uint top = skinConfInt["topBarHeight"] + 1; - const uint bottom = skinConfInt["bottomBarHeight"] + 1; - const uint height = resY - top - bottom; + unsigned int top, height; + tie(top, height) = getContentArea(); + top += 1; + height -= 2; s->rectangle(resX - 8, top, 7, height, skinConfColors[COLOR_SELECTION_BG]); + top += 2; + height -= 4; - const uint barSize = (height - 4) * pageSize / totalSize; - const uint barPos = (height - 4 - barSize) * pagePos / (totalSize - pageSize); + const uint barSize = height * pageSize / totalSize; + const uint barPos = (height - barSize) * pagePos / (totalSize - pageSize); - s->box(resX - 6, top + 2 + barPos, 3, barSize, + s->box(resX - 6, top + barPos, 3, barSize, skinConfColors[COLOR_SELECTION_BG]); } diff --git a/src/gmenu2x.h b/src/gmenu2x.h index d597580..03e769c 100644 --- a/src/gmenu2x.h +++ b/src/gmenu2x.h @@ -134,6 +134,15 @@ public: unsigned short cpuX; //!< Offset for displaying cpu clock information unsigned short manualX; //!< Offset for displaying the manual indicator in the taskbar + /** + * Gets the position and height of the area between the top and bottom bars. + */ + std::pair getContentArea() { + const unsigned int top = skinConfInt["topBarHeight"]; + const unsigned int bottom = skinConfInt["bottomBarHeight"]; + return std::make_pair(top, resY - top - bottom); + } + InputManager input; //Configuration hashes