mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
ae26b835b6
Things that were once singletons are no longer singletons, but are instead stored in the "Application" singleton Some singletons still remain, and some renaming/renamespacing is left
70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "basewidget.hpp"
|
|
#include "widgets/helper/titlebarbutton.hpp"
|
|
|
|
#include <functional>
|
|
|
|
class QHBoxLayout;
|
|
|
|
namespace chatterino {
|
|
namespace widgets {
|
|
|
|
class RippleEffectButton;
|
|
class RippleEffectLabel;
|
|
class TitleBarButton;
|
|
|
|
class BaseWindow : public BaseWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit BaseWindow(QWidget *parent = nullptr, bool enableCustomFrame = false);
|
|
|
|
QWidget *getLayoutContainer();
|
|
bool hasCustomWindowFrame();
|
|
void addTitleBarButton(const TitleBarButton::Style &style, std::function<void()> onClicked);
|
|
RippleEffectLabel *addTitleBarLabel(std::function<void()> onClicked);
|
|
|
|
void setStayInScreenRect(bool value);
|
|
bool getStayInScreenRect() const;
|
|
|
|
void moveTo(QWidget *widget, QPoint point);
|
|
|
|
protected:
|
|
#ifdef USEWINSDK
|
|
void showEvent(QShowEvent *) override;
|
|
bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
|
|
void paintEvent(QPaintEvent *) override;
|
|
void scaleChangedEvent(float) override;
|
|
#endif
|
|
|
|
void changeEvent(QEvent *) override;
|
|
void leaveEvent(QEvent *) override;
|
|
void resizeEvent(QResizeEvent *) override;
|
|
|
|
void themeRefreshEvent() override;
|
|
|
|
private:
|
|
void init();
|
|
void moveIntoDesktopRect(QWidget *parent);
|
|
void calcButtonsSizes();
|
|
|
|
bool enableCustomFrame;
|
|
bool stayInScreenRect = false;
|
|
bool shown = false;
|
|
|
|
struct {
|
|
QHBoxLayout *titlebarBox;
|
|
QWidget *titleLabel;
|
|
TitleBarButton *minButton = nullptr;
|
|
TitleBarButton *maxButton = nullptr;
|
|
TitleBarButton *exitButton = nullptr;
|
|
QWidget *layoutBase;
|
|
std::vector<RippleEffectButton *> buttons;
|
|
} ui;
|
|
};
|
|
|
|
} // namespace widgets
|
|
} // namespace chatterino
|