2016-12-29 17:31:07 +01:00
|
|
|
#ifndef NOTEBOOKPAGE_H
|
|
|
|
#define NOTEBOOKPAGE_H
|
|
|
|
|
|
|
|
#include "QWidget"
|
2017-01-01 02:30:42 +01:00
|
|
|
#include "QRect"
|
|
|
|
#include "QVector"
|
|
|
|
#include "QHBoxLayout"
|
|
|
|
#include "QVBoxLayout"
|
|
|
|
#include "QDragEnterEvent"
|
2016-12-30 18:00:25 +01:00
|
|
|
#include "notebookpage.h"
|
|
|
|
#include "notebooktab.h"
|
2017-01-01 02:30:42 +01:00
|
|
|
#include "chatwidget.h"
|
|
|
|
#include "notebookpagedroppreview.h"
|
2016-12-30 12:20:26 +01:00
|
|
|
|
2016-12-29 17:31:07 +01:00
|
|
|
class NotebookPage : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-01-01 02:30:42 +01:00
|
|
|
NotebookPage(QWidget *parent, NotebookTab *tab);
|
2016-12-30 12:20:26 +01:00
|
|
|
NotebookTab* tab;
|
2017-01-01 02:30:42 +01:00
|
|
|
QVBoxLayout parentbox;
|
|
|
|
QHBoxLayout hbox;
|
|
|
|
|
|
|
|
std::pair<int, int> removeFromLayout(ChatWidget* widget);
|
|
|
|
void addToLayout(ChatWidget* widget, std::pair<int, int> position);
|
|
|
|
|
|
|
|
static bool isDraggingSplit;
|
|
|
|
static ChatWidget* draggingSplit;
|
|
|
|
static std::pair<int, int> dropPosition;
|
2016-12-30 18:00:25 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
|
2017-01-01 02:30:42 +01:00
|
|
|
|
|
|
|
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
struct DropRegion
|
|
|
|
{
|
|
|
|
QRect rect;
|
|
|
|
std::pair<int, int> position;
|
|
|
|
|
|
|
|
DropRegion(QRect rect, std::pair<int, int> position)
|
|
|
|
{
|
|
|
|
this->rect = rect;
|
|
|
|
this->position = position;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<DropRegion> dropRegions;
|
|
|
|
|
|
|
|
NotebookPageDropPreview preview;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setPreviewRect(QPoint mousePos);
|
2016-12-29 17:31:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NOTEBOOKPAGE_H
|