summaryrefslogtreecommitdiff
path: root/plugingui/label.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/label.h')
-rw-r--r--plugingui/label.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/plugingui/label.h b/plugingui/label.h
index 50f02d6..794778d 100644
--- a/plugingui/label.h
+++ b/plugingui/label.h
@@ -24,30 +24,41 @@
* 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 "font.h"
-#include "guievent.h"
+#include <string>
namespace GUI {
+enum class TextAlignment {
+ left,
+ center,
+ right,
+};
+
class Label : public Widget {
public:
- Label(Widget *parent);
+ Label(Widget *parent);
- void setText(std::string text);
+ void setText(const std::string& text);
- //protected:
- virtual void repaintEvent(RepaintEvent *e);
+ void setAlignment(TextAlignment alignment);
-private:
- std::string _text;
-};
+ void resizeToText();
+protected:
+ // From Widget:
+ virtual void repaintEvent(RepaintEvent* repaintEvent) override;
+
+private:
+ std::string _text;
+ Font font{":fontemboss.png"};
+ TextAlignment alignment{TextAlignment::left};
+ int border{0};
};
-#endif/*__DRUMGIZMO_LABEL_H__*/
+} // GUI::