| 51 | } |
| 52 | |
| 53 | int UITheme::getNumberOfItemsPerPage(const GfxRenderer& renderer, bool hasHeader, bool hasTabBar, bool hasButtonHints, |
| 54 | bool hasSubtitle, int extraReservedHeight) { |
| 55 | const ThemeMetrics& metrics = UITheme::getInstance().getMetrics(); |
| 56 | auto orientation = renderer.getOrientation(); |
| 57 | int reservedHeight = metrics.topPadding; |
| 58 | if (hasHeader) { |
| 59 | reservedHeight += metrics.headerHeight + metrics.verticalSpacing; |
| 60 | } |
| 61 | if (hasTabBar) { |
| 62 | reservedHeight += metrics.tabBarHeight; |
| 63 | } |
| 64 | if (hasButtonHints && orientation != GfxRenderer::Orientation::LandscapeClockwise && |
| 65 | orientation != GfxRenderer::Orientation::LandscapeCounterClockwise) { |
| 66 | reservedHeight += metrics.verticalSpacing + metrics.buttonHintsHeight; |
| 67 | } |
| 68 | const int availableHeight = renderer.getScreenHeight() - reservedHeight - extraReservedHeight; |
| 69 | int rowHeight = hasSubtitle ? metrics.listWithSubtitleRowHeight : metrics.listRowHeight; |
| 70 | return availableHeight / rowHeight; |
| 71 | } |
| 72 | |
| 73 | // Screen area excluding the button hints |
| 74 | Rect UITheme::getScreenSafeArea(const GfxRenderer& renderer, bool hasFrontButtonHints, bool hasSideButtonHints) { |
no test coverage detected