2022-03-26 02:57:41 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Widget.hpp"
|
2022-07-26 02:44:09 +03:00
|
|
|
#include "Painter.hpp"
|
2022-03-26 02:57:41 +02:00
|
|
|
|
|
|
|
namespace Raven {
|
|
|
|
|
|
|
|
class Label : public Widget {
|
|
|
|
public:
|
|
|
|
Label(std::string text)
|
2022-05-10 16:17:12 +03:00
|
|
|
: Widget(WidgetType::Label)
|
2022-03-26 02:57:41 +02:00
|
|
|
, m_text(text) {}
|
|
|
|
|
2022-07-26 02:44:09 +03:00
|
|
|
Label(std::string text, PaintTextAlign align)
|
|
|
|
: Widget(WidgetType::Label)
|
|
|
|
, m_text(text)
|
|
|
|
, m_align(align) {}
|
|
|
|
|
2022-03-26 02:57:41 +02:00
|
|
|
~Label() {}
|
2022-03-29 07:00:03 +03:00
|
|
|
|
2022-05-14 13:05:52 +03:00
|
|
|
void set_text(std::string text);
|
2022-05-15 10:54:30 +03:00
|
|
|
std::string &text() { return m_text; }
|
2022-07-26 02:44:09 +03:00
|
|
|
|
|
|
|
PaintTextAlign &align() { return m_align; }
|
|
|
|
void set_align(PaintTextAlign align) { m_align = align; }
|
2022-03-26 02:57:41 +02:00
|
|
|
protected:
|
|
|
|
void on_paint();
|
|
|
|
void on_init();
|
2022-05-15 10:54:30 +03:00
|
|
|
private:
|
|
|
|
std::string m_text;
|
2022-07-26 02:44:09 +03:00
|
|
|
PaintTextAlign m_align { PaintTextAlign::Left };
|
2022-03-26 02:57:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|