2018-05-08 15:12:04 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-05-10 23:58:07 +02:00
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QPushButton>
|
|
|
|
|
2018-05-08 15:12:04 +02:00
|
|
|
#include "pajlada/signals/signalholder.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "widgets/BaseWidget.hpp"
|
2018-05-08 15:12:04 +02:00
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
|
|
|
|
class Split;
|
|
|
|
|
|
|
|
class SplitOverlay : public BaseWidget, pajlada::Signals::SignalHolder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit SplitOverlay(Split *parent = nullptr);
|
|
|
|
|
|
|
|
protected:
|
2018-05-17 16:39:38 +02:00
|
|
|
// bool event(QEvent *event) override;
|
2018-05-08 15:12:04 +02:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
2018-05-10 23:58:07 +02:00
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
2018-05-17 14:47:23 +02:00
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
2018-05-08 15:12:04 +02:00
|
|
|
|
|
|
|
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 };
|
2018-05-08 15:12:04 +02:00
|
|
|
|
|
|
|
class ButtonEventFilter : public QObject
|
|
|
|
{
|
|
|
|
SplitOverlay *parent;
|
2018-06-04 16:34:47 +02:00
|
|
|
HoveredElement hoveredElement;
|
2018-05-08 15:12:04 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
ButtonEventFilter(SplitOverlay *parent, HoveredElement hoveredElement);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
|
|
|
};
|
|
|
|
|
2018-07-06 19:23:47 +02:00
|
|
|
HoveredElement hoveredElement_ = None;
|
|
|
|
Split *split_;
|
|
|
|
QGridLayout *layout_;
|
|
|
|
QPushButton *left_;
|
|
|
|
QPushButton *up_;
|
|
|
|
QPushButton *right_;
|
|
|
|
QPushButton *down_;
|
|
|
|
|
2018-05-08 15:12:04 +02:00
|
|
|
friend class ButtonEventFilter;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|