2019-09-08 22:27:57 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QPushButton>
|
|
|
|
|
|
|
|
#include "pajlada/signals/signalholder.hpp"
|
|
|
|
#include "widgets/BaseWidget.hpp"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class Split;
|
|
|
|
|
2021-12-19 15:57:56 +01:00
|
|
|
class SplitOverlay : public BaseWidget
|
2019-09-08 22:27:57 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SplitOverlay(Split *parent = nullptr);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// bool event(QEvent *event) override;
|
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// fourtf: !!! preserve the order of left, up, right and down
|
|
|
|
enum HoveredElement {
|
|
|
|
None,
|
|
|
|
SplitMove,
|
|
|
|
SplitLeft,
|
|
|
|
SplitUp,
|
|
|
|
SplitRight,
|
|
|
|
SplitDown
|
|
|
|
};
|
|
|
|
|
|
|
|
class ButtonEventFilter : public QObject
|
|
|
|
{
|
|
|
|
SplitOverlay *parent;
|
|
|
|
HoveredElement hoveredElement;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ButtonEventFilter(SplitOverlay *parent, HoveredElement hoveredElement);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
HoveredElement hoveredElement_ = None;
|
|
|
|
Split *split_;
|
|
|
|
QGridLayout *layout_;
|
|
|
|
QPushButton *left_;
|
|
|
|
QPushButton *up_;
|
|
|
|
QPushButton *right_;
|
|
|
|
QPushButton *down_;
|
|
|
|
|
2021-12-19 15:57:56 +01:00
|
|
|
pajlada::Signals::SignalHolder signalHolder_;
|
|
|
|
|
2019-09-08 22:27:57 +02:00
|
|
|
friend class ButtonEventFilter;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|