Files
Upsilon/apps/shared/banner_view.h
Hugo Saint-Vignes e27c668c40 [apps,escher,kandinsky,poincare,python] Replace every "grey" with "gray"
Change-Id: I60a232849dce90f70e6977b6024d6e9b1ce1b731
2020-11-04 15:07:20 +01:00

29 lines
931 B
C++

#ifndef SHARED_BANNER_VIEW_H
#define SHARED_BANNER_VIEW_H
#include <escher.h>
namespace Shared {
class BannerView : public View {
public:
static KDCoordinate HeightGivenNumberOfLines(int linesCount);
void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override;
KDCoordinate minimalHeightForOptimalDisplayGivenWidth(KDCoordinate width) const;
void reload() { layoutSubviews(); }
static constexpr const KDFont * Font() { return KDFont::SmallFont; }
static constexpr KDColor TextColor() { return KDColorBlack; }
static constexpr KDColor BackgroundColor() { return Palette::GrayMiddle; }
private:
static constexpr KDCoordinate LineSpacing = 2;
int numberOfSubviews() const override = 0;
View * subviewAtIndex(int index) override = 0;
void layoutSubviews(bool force = false) override;
int numberOfLinesGivenWidth(KDCoordinate width) const;
};
}
#endif