2018-06-11 15:04:54 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-06-28 19:46:45 +02:00
|
|
|
#include "singletons/Fonts.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "widgets/BaseWidget.hpp"
|
2018-06-11 15:04:54 +02:00
|
|
|
|
2018-06-24 13:32:56 +02:00
|
|
|
#include <pajlada/signals/signalholder.hpp>
|
|
|
|
|
2018-06-11 15:04:54 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class Label : public BaseWidget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Label(QString text = QString(), FontStyle style = FontStyle::UiMedium);
|
|
|
|
explicit Label(BaseWidget *parent, QString text = QString(),
|
|
|
|
FontStyle style = FontStyle::UiMedium);
|
|
|
|
|
|
|
|
const QString &getText() const;
|
|
|
|
void setText(const QString &text);
|
|
|
|
|
|
|
|
FontStyle getFontStyle() const;
|
|
|
|
void setFontStyle(FontStyle style);
|
|
|
|
|
|
|
|
bool getCentered() const;
|
|
|
|
void setCentered(bool centered);
|
|
|
|
|
|
|
|
bool getHasOffset() const;
|
2018-06-19 18:55:45 +02:00
|
|
|
void setHasOffset(bool hasOffset);
|
2018-06-11 15:04:54 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void scaleChangedEvent(float scale) override;
|
|
|
|
virtual void paintEvent(QPaintEvent *) override;
|
|
|
|
|
|
|
|
virtual QSize sizeHint() const override;
|
|
|
|
virtual QSize minimumSizeHint() const override;
|
|
|
|
|
|
|
|
private:
|
2018-06-24 13:32:56 +02:00
|
|
|
pajlada::Signals::SignalHolder connections_;
|
|
|
|
|
2018-06-11 15:04:54 +02:00
|
|
|
QString text_;
|
|
|
|
FontStyle fontStyle_;
|
|
|
|
QSize preferedSize_;
|
|
|
|
bool centered_ = false;
|
|
|
|
bool hasOffset_ = true;
|
|
|
|
|
|
|
|
void updateSize();
|
2018-06-11 21:57:17 +02:00
|
|
|
int getOffset();
|
2018-06-11 15:04:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|