2018-01-14 21:55:36 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "basewidget.hpp"
|
|
|
|
|
2018-01-24 15:08:22 +01:00
|
|
|
#include <functional>
|
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
class QHBoxLayout;
|
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
2018-01-24 15:08:22 +01:00
|
|
|
class RippleEffectLabel;
|
2018-01-14 21:55:36 +01:00
|
|
|
|
|
|
|
class BaseWindow : public BaseWidget
|
|
|
|
{
|
|
|
|
public:
|
2018-01-15 01:35:35 +01:00
|
|
|
explicit BaseWindow(singletons::ThemeManager &_themeManager, QWidget *parent,
|
|
|
|
bool enableCustomFrame = false);
|
|
|
|
explicit BaseWindow(BaseWidget *parent, bool enableCustomFrame = false);
|
|
|
|
explicit BaseWindow(QWidget *parent = nullptr, bool enableCustomFrame = false);
|
|
|
|
|
|
|
|
QWidget *getLayoutContainer();
|
|
|
|
bool hasCustomWindowFrame();
|
2018-01-24 15:08:22 +01:00
|
|
|
void addTitleBarButton(const QString &text, std::function<void()> onClicked);
|
2018-01-14 21:55:36 +01:00
|
|
|
|
2018-01-22 20:52:32 +01:00
|
|
|
void setStayInScreenRect(bool value);
|
|
|
|
bool getStayInScreenRect() const;
|
|
|
|
|
|
|
|
void moveTo(QWidget *widget, QPoint point);
|
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
protected:
|
|
|
|
#ifdef USEWINSDK
|
2018-01-15 01:35:35 +01:00
|
|
|
virtual void showEvent(QShowEvent *);
|
2018-01-14 21:55:36 +01:00
|
|
|
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
2018-01-15 01:35:35 +01:00
|
|
|
virtual void paintEvent(QPaintEvent *event) override;
|
2018-01-14 21:55:36 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual void changeEvent(QEvent *) override;
|
|
|
|
virtual void leaveEvent(QEvent *) override;
|
2018-01-22 20:52:32 +01:00
|
|
|
virtual void resizeEvent(QResizeEvent *) override;
|
2018-01-14 21:55:36 +01:00
|
|
|
|
2018-01-15 01:35:35 +01:00
|
|
|
virtual void refreshTheme() override;
|
|
|
|
|
2018-01-14 21:55:36 +01:00
|
|
|
private:
|
|
|
|
void init();
|
2018-01-22 20:52:32 +01:00
|
|
|
void moveIntoDesktopRect(QWidget *parent);
|
2018-01-15 01:35:35 +01:00
|
|
|
|
|
|
|
bool enableCustomFrame;
|
2018-01-22 20:52:32 +01:00
|
|
|
bool stayInScreenRect = false;
|
2018-01-24 15:08:22 +01:00
|
|
|
bool shown = false;
|
2018-01-15 01:35:35 +01:00
|
|
|
|
|
|
|
QHBoxLayout *titlebarBox;
|
|
|
|
QWidget *titleLabel;
|
2018-01-24 15:08:22 +01:00
|
|
|
RippleEffectLabel *minButton;
|
|
|
|
RippleEffectLabel *maxButton;
|
|
|
|
RippleEffectLabel *exitButton;
|
2018-01-15 01:35:35 +01:00
|
|
|
QWidget *layoutBase;
|
2018-01-24 15:08:22 +01:00
|
|
|
std::vector<RippleEffectLabel *> buttons;
|
2018-01-14 21:55:36 +01:00
|
|
|
};
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|