1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-29 09:02:27 +02:00

Added method GMenu2X::getContentArea()

This commit is contained in:
Maarten ter Huurne 2013-08-14 12:56:15 +02:00
parent 19fc3cb4d1
commit 91dd708476
2 changed files with 18 additions and 6 deletions

View File

@ -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]);
}

View File

@ -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<unsigned int, unsigned int> 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