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"
|
|
|
|
#include "widgets/basewidget.hpp"
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
namespace widgets {
|
|
|
|
|
|
|
|
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
|
|
|
HoveredElement hoveredElement = None;
|
|
|
|
Split *split;
|
2018-05-10 23:58:07 +02:00
|
|
|
QGridLayout *_layout;
|
|
|
|
QPushButton *_left;
|
|
|
|
QPushButton *_up;
|
|
|
|
QPushButton *_right;
|
|
|
|
QPushButton *_down;
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
friend class ButtonEventFilter;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widgets
|
|
|
|
} // namespace chatterino
|