2017-06-26 16:41:20 +02:00
|
|
|
#pragma once
|
2017-06-26 15:53:43 +02:00
|
|
|
|
2017-06-26 16:41:20 +02:00
|
|
|
#include <QWidget>
|
2018-01-25 20:49:49 +01:00
|
|
|
#include <pajlada/signals/signal.hpp>
|
2017-06-26 16:41:20 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
2017-12-31 22:58:35 +01:00
|
|
|
namespace singletons {
|
2017-12-31 00:50:07 +01:00
|
|
|
class ThemeManager;
|
2018-04-03 02:55:32 +02:00
|
|
|
} // namespace singletons
|
2017-06-26 16:41:20 +02:00
|
|
|
|
|
|
|
namespace widgets {
|
2018-04-03 02:55:32 +02:00
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
class BaseWindow;
|
2017-06-26 16:41:20 +02:00
|
|
|
|
|
|
|
class BaseWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-04-27 22:11:19 +02:00
|
|
|
explicit BaseWidget(QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
|
2018-05-26 16:31:43 +02:00
|
|
|
virtual ~BaseWidget() override;
|
2017-12-17 16:45:15 +01:00
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
float getScale() const;
|
|
|
|
pajlada::Signals::Signal<float> scaleChanged;
|
2017-09-22 00:50:43 +02:00
|
|
|
|
2018-01-25 21:11:14 +01:00
|
|
|
QSize getScaleIndependantSize() const;
|
|
|
|
int getScaleIndependantWidth() const;
|
|
|
|
int getScaleIndependantHeight() const;
|
2018-05-23 22:27:29 +02:00
|
|
|
void setScaleIndependantSize(int width, int height);
|
2018-01-25 21:11:14 +01:00
|
|
|
void setScaleIndependantSize(QSize);
|
|
|
|
void setScaleIndependantWidth(int value);
|
|
|
|
void setScaleIndependantHeight(int value);
|
|
|
|
|
2017-09-22 00:50:43 +02:00
|
|
|
protected:
|
2018-04-03 02:55:32 +02:00
|
|
|
void childEvent(QChildEvent *) override;
|
2017-09-22 00:50:43 +02:00
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
virtual void scaleChangedEvent(float newScale);
|
|
|
|
virtual void themeRefreshEvent();
|
2017-09-22 00:50:43 +02:00
|
|
|
|
2018-04-18 09:33:05 +02:00
|
|
|
virtual void showEvent(QShowEvent *) override;
|
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
void setScale(float value);
|
2018-01-24 20:35:26 +01:00
|
|
|
|
2018-04-27 22:11:19 +02:00
|
|
|
singletons::ThemeManager *themeManager;
|
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
private:
|
2017-07-02 14:28:37 +02:00
|
|
|
void init();
|
2018-01-25 20:49:49 +01:00
|
|
|
float scale = 1.f;
|
2018-01-25 21:11:14 +01:00
|
|
|
QSize scaleIndependantSize;
|
2018-01-25 20:49:49 +01:00
|
|
|
|
|
|
|
std::vector<BaseWidget *> widgets;
|
|
|
|
|
2018-04-13 23:17:10 +02:00
|
|
|
pajlada::Signals::Connection themeConnection;
|
|
|
|
|
2018-01-25 20:49:49 +01:00
|
|
|
static void setScaleRecursive(float scale, QObject *object);
|
|
|
|
|
|
|
|
friend class BaseWindow;
|
2017-06-26 16:41:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|