mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 12:30:18 +02:00
Redistribute any leftover vertical space in Selector
This commit is contained in:
parent
ffb736d80f
commit
3cce71284a
@ -75,11 +75,15 @@ int Selector::exec(int startSelection) {
|
|||||||
|
|
||||||
auto folderIcon = gmenu2x->sc.skinRes("imgs/folder.png");
|
auto folderIcon = gmenu2x->sc.skinRes("imgs/folder.png");
|
||||||
|
|
||||||
|
// Figure out how many items we can fit in the content area.
|
||||||
int lineHeight = gmenu2x->font->getLineSpacing();
|
int lineHeight = gmenu2x->font->getLineSpacing();
|
||||||
if (showDirectories && folderIcon) {
|
if (showDirectories && folderIcon) {
|
||||||
lineHeight = max(lineHeight, folderIcon->height() + 2);
|
lineHeight = max(lineHeight, folderIcon->height() + 2);
|
||||||
}
|
}
|
||||||
unsigned int nb_elements = max(height / lineHeight, 1u);
|
unsigned int nb_elements = max(height / lineHeight, 1u);
|
||||||
|
// Redistribute any leftover space.
|
||||||
|
lineHeight = height / nb_elements;
|
||||||
|
top += (height - lineHeight * nb_elements) / 2;
|
||||||
|
|
||||||
bg.convertToDisplayFormat();
|
bg.convertToDisplayFormat();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user