diff --git a/src/Label.hpp b/src/Label.hpp index c2d9fb8..6b467ff 100644 --- a/src/Label.hpp +++ b/src/Label.hpp @@ -6,15 +6,17 @@ namespace Raven { class Label : public Widget { -DEF_WIDGET_STYLE_PROP(text, std::string, "") - private: + std::string m_text; public: Label(std::string text) : Widget() , m_text(text) {} ~Label() {} + + std::string &get_text() { return m_text; } + void set_text(std::string text) { m_text = text; wants_full_repaint(); } protected: void on_paint(); void on_init(); diff --git a/src/Widget.cpp b/src/Widget.cpp index 59ab9ee..45e4f60 100644 --- a/src/Widget.cpp +++ b/src/Widget.cpp @@ -45,10 +45,14 @@ void Widget::do_generic_paint() { } void Widget::wants_repaint() { - // TODOO: not necessary + // TODO: not necessary? m_window->widget_repaint(this); } +void Widget::wants_full_repaint() { + m_window->dispatch_full_repaint(); +} + void Widget::handle_repaint(WidgetRepaintRequestedEvent &event) { // immediately accept the event - we will do our own propagation logic event.accept(); diff --git a/src/Widget.hpp b/src/Widget.hpp index 70a6279..419acd1 100644 --- a/src/Widget.hpp +++ b/src/Widget.hpp @@ -46,7 +46,7 @@ public: void set_window(Window *window); std::shared_ptr get_styles() { return m_styles; } - void set__styles(std::shared_ptr styles) { m_styles = styles; wants_repaint(); } + void set_styles(std::shared_ptr styles) { m_styles = styles; wants_repaint(); } void set_did_init(bool did_init) { m_did_init = did_init; } bool get_did_init() { return m_did_init; } @@ -61,7 +61,7 @@ public: void dispatch_event(Event &event); void wants_repaint(); - + void wants_full_repaint(); virtual ~Widget() {}; protected: