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>
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
class ThemeManager;
|
2017-06-26 16:41:20 +02:00
|
|
|
|
|
|
|
namespace widgets {
|
|
|
|
|
|
|
|
class BaseWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-12-31 00:50:07 +01:00
|
|
|
explicit BaseWidget(ThemeManager &_themeManager, QWidget *parent);
|
2017-07-02 14:28:37 +02:00
|
|
|
|
|
|
|
explicit BaseWidget(BaseWidget *parent);
|
2017-06-26 16:41:20 +02:00
|
|
|
|
2017-12-17 16:45:15 +01:00
|
|
|
explicit BaseWidget(QWidget *parent = nullptr);
|
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
ThemeManager &themeManager;
|
2017-07-02 14:28:37 +02:00
|
|
|
|
2017-09-22 00:50:43 +02:00
|
|
|
float getDpiMultiplier();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
#ifdef USEWINSDK
|
|
|
|
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
|
|
|
#endif
|
2017-12-18 00:54:17 +01:00
|
|
|
|
2017-12-24 23:56:08 +01:00
|
|
|
virtual void changeEvent(QEvent *) override;
|
|
|
|
virtual void leaveEvent(QEvent *) override;
|
2017-12-24 16:01:01 +01:00
|
|
|
|
2017-12-22 15:13:42 +01:00
|
|
|
virtual void dpiMultiplierChanged(float /*oldDpi*/, float /*newDpi*/)
|
2017-12-18 00:54:17 +01:00
|
|
|
{
|
|
|
|
}
|
2017-09-23 18:37:51 +02:00
|
|
|
void initAsWindow();
|
2017-09-22 00:50:43 +02:00
|
|
|
|
2017-07-02 14:28:37 +02:00
|
|
|
private:
|
2017-12-24 16:01:01 +01:00
|
|
|
bool isWindow = false;
|
2017-09-22 00:50:43 +02:00
|
|
|
float dpiMultiplier = 1.f;
|
|
|
|
|
2017-07-02 14:28:37 +02:00
|
|
|
void init();
|
|
|
|
|
|
|
|
virtual void refreshTheme();
|
2017-06-26 16:41:20 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|