mirror-chatterino2/src/widgets/basewindow.hpp
Rasmus Karlsson 6ea3a1df08 Switch some c-style includes to c++-style includes (i.e. stdint.h to
cstdint)

Make MessageElement to a class to fit better with the derived classes.
Make MessageLayoutElement to a class to fit better with the derived
classes.

Remove virtual from override functions

Replace all instances of boost::signals2 with pajlada::Signals. This
lets us properly use clang code model to check for issues.

Add missing virtual destructor to AbstractIrcServer
Add missing virtual destructor to MessageLayoutElement

Remove unused "connectedConnection" connection in TwitchChannel

Fix typo in TrimChannelName function
Fix typo in MessageParseArgs

Replace some raw pointers with unique pointers where it made more sense.
This allowed us to remove some manually written destructors whose only
purpose was to delete that raw pointer.

Reformat: Add namespace comments
Reformat: Add empty empty lines between main namespace beginning and end
Reformat: Re-order includes
Reformat: Fix some includes that used quotes where they should use angle
brackets
Reformat: Replace some typedef's with using's

Filter out more useless warnings
2018-04-11 22:54:34 +02:00

69 lines
1.9 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(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();
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
virtual void showEvent(QShowEvent *);
virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
virtual void paintEvent(QPaintEvent *event) override;
#endif
virtual void changeEvent(QEvent *) override;
virtual void leaveEvent(QEvent *) override;
virtual void resizeEvent(QResizeEvent *) override;
virtual void themeRefreshEvent() override;
private:
void init();
void moveIntoDesktopRect(QWidget *parent);
bool enableCustomFrame;
bool stayInScreenRect = false;
bool shown = false;
QHBoxLayout *titlebarBox;
QWidget *titleLabel;
TitleBarButton *minButton;
TitleBarButton *maxButton;
TitleBarButton *exitButton;
QWidget *layoutBase;
std::vector<RippleEffectButton *> buttons;
};
} // namespace widgets
} // namespace chatterino