diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-09-04 21:21:50 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-09-04 21:21:50 +0200 |
commit | 04ce68074dd7c737b52e2dd279d2c56d18ebf6db (patch) | |
tree | 56a149f6504ad9f15486f6ffdbefb7484d7a68d0 | |
parent | 3ec43973d1e269c5e6124e02276107c2c3020180 (diff) |
Refactored Label.
-rw-r--r-- | plugingui/label.cc | 28 | ||||
-rw-r--r-- | plugingui/label.h | 16 |
2 files changed, 15 insertions, 29 deletions
diff --git a/plugingui/label.cc b/plugingui/label.cc index bcc7005..be37d82 100644 --- a/plugingui/label.cc +++ b/plugingui/label.cc @@ -27,18 +27,22 @@ #include "label.h" #include "painter.h" +#include "guievent.h" -GUI::Label::Label(GUI::Widget *parent) : GUI::Widget(parent) +namespace GUI { + +Label::Label(GUI::Widget *parent) + : Widget(parent) { } -void GUI::Label::setText(std::string text) +void Label::setText(std::string text) { _text = text; repaintEvent(NULL); } -void GUI::Label::repaintEvent(GUI::RepaintEvent *e) +void Label::repaintEvent(GUI::RepaintEvent *e) { Painter p(this); @@ -50,20 +54,4 @@ void GUI::Label::repaintEvent(GUI::RepaintEvent *e) p.drawText(10, (height() + font.textHeight()) / 2, font, _text, true); } - -#ifdef TEST_LABEL -//Additional dependency files -//deps: -//Required cflags (autoconf vars may be used) -//cflags: -//Required link options (autoconf vars may be used) -//libs: -#include "test.h" - -TEST_BEGIN; - -// TODO: Put some testcode here (see test.h for usable macros). - -TEST_END; - -#endif/*TEST_LABEL*/ +} // GUI:: diff --git a/plugingui/label.h b/plugingui/label.h index 50f02d6..707cdb1 100644 --- a/plugingui/label.h +++ b/plugingui/label.h @@ -24,30 +24,28 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __DRUMGIZMO_LABEL_H__ -#define __DRUMGIZMO_LABEL_H__ +#pragma once #include "widget.h" #include <string> -#include "guievent.h" - namespace GUI { +class RepaintEvent; + class Label : public Widget { public: Label(Widget *parent); void setText(std::string text); - //protected: - virtual void repaintEvent(RepaintEvent *e); +protected: + // From Widget: + virtual void repaintEvent(RepaintEvent *e) override; private: std::string _text; }; -}; - -#endif/*__DRUMGIZMO_LABEL_H__*/ +} // GUI:: |