1 #pragma once 2 #include "NanoVG.hpp" 3 #include "ui/FontEngine.h" 4 class ColorPalette; 5 6 class TextLabel : public NanoWidget { 7 public: 8 TextLabel(Widget *group, const ColorPalette &palette); 9 font()10 const Font &font() const { return fFont; }; 11 void setFont(const Font &font); 12 text()13 const std::string &text() const { return fText; } 14 void setText(std::string text); 15 alignment()16 int alignment() const { return fAlign; } 17 void setAlignment(int align); 18 19 protected: 20 void onNanoDisplay() override; 21 22 private: 23 const ColorPalette &fPalette; 24 Font fFont; 25 std::string fText; 26 int fAlign = kAlignLeft|kAlignTop|kAlignInside; 27 }; 28