mirror-chatterino2/src/widgets/splits/SplitOverlay.hpp

53 lines
1.3 KiB
C++
Raw Normal View History

#pragma once
2018-05-10 23:58:07 +02:00
#include <QGridLayout>
#include <QPushButton>
#include "pajlada/signals/signalholder.hpp"
2018-06-26 14:09:39 +02:00
#include "widgets/BaseWidget.hpp"
namespace chatterino {
namespace widgets {
class Split;
class SplitOverlay : public BaseWidget, pajlada::Signals::SignalHolder
{
public:
explicit SplitOverlay(Split *parent = nullptr);
protected:
// bool event(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
2018-05-10 23:58:07 +02:00
void resizeEvent(QResizeEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
private:
2018-05-10 19:50:31 +02:00
// fourtf: !!! preserve the order of left, up, right and down
enum HoveredElement { None, SplitMove, SplitLeft, SplitUp, SplitRight, SplitDown };
HoveredElement hoveredElement = None;
Split *split;
2018-05-10 23:58:07 +02:00
QGridLayout *_layout;
QPushButton *_left;
QPushButton *_up;
QPushButton *_right;
QPushButton *_down;
class ButtonEventFilter : public QObject
{
SplitOverlay *parent;
HoveredElement hoveredElement;
public:
ButtonEventFilter(SplitOverlay *parent, HoveredElement hoveredElement);
protected:
bool eventFilter(QObject *watched, QEvent *event) override;
};
friend class ButtonEventFilter;
};
} // namespace widgets
} // namespace chatterino