raven/src/Label.hpp
2022-07-26 02:44:09 +03:00

34 lines
698 B
C++

#pragma once
#include "Widget.hpp"
#include "Painter.hpp"
namespace Raven {
class Label : public Widget {
public:
Label(std::string text)
: Widget(WidgetType::Label)
, m_text(text) {}
Label(std::string text, PaintTextAlign align)
: Widget(WidgetType::Label)
, m_text(text)
, m_align(align) {}
~Label() {}
void set_text(std::string text);
std::string &text() { return m_text; }
PaintTextAlign &align() { return m_align; }
void set_align(PaintTextAlign align) { m_align = align; }
protected:
void on_paint();
void on_init();
private:
std::string m_text;
PaintTextAlign m_align { PaintTextAlign::Left };
};
}