mirror-chatterino2/src/widgets/basewidget.hpp

51 lines
958 B
C++
Raw Normal View History

#pragma once
#include <QWidget>
namespace chatterino {
2017-12-31 22:58:35 +01:00
namespace singletons {
2017-12-31 00:50:07 +01:00
class ThemeManager;
2017-12-31 22:58:35 +01:00
}
namespace widgets {
class BaseWidget : public QWidget
{
Q_OBJECT
public:
2017-12-31 22:58:35 +01:00
explicit BaseWidget(singletons::ThemeManager &_themeManager, QWidget *parent);
explicit BaseWidget(BaseWidget *parent);
2017-12-17 16:45:15 +01:00
explicit BaseWidget(QWidget *parent = nullptr);
2017-12-31 22:58:35 +01:00
singletons::ThemeManager &themeManager;
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
virtual void changeEvent(QEvent *) override;
virtual void leaveEvent(QEvent *) override;
virtual void dpiMultiplierChanged(float /*oldDpi*/, float /*newDpi*/)
{
}
void initAsWindow();
2017-09-22 00:50:43 +02:00
private:
bool isWindow = false;
2017-09-22 00:50:43 +02:00
float dpiMultiplier = 1.f;
void init();
virtual void refreshTheme();
};
} // namespace widgets
} // namespace chatterino