#ifndef NOTEBOOKPAGE_H #define NOTEBOOKPAGE_H #include "QDragEnterEvent" #include "QHBoxLayout" #include "QRect" #include "QVBoxLayout" #include "QVector" #include "QWidget" #include "chatwidget.h" #include "notebookpage.h" #include "notebookpagedroppreview.h" #include "notebooktab.h" class NotebookPage : public QWidget { Q_OBJECT public: NotebookPage(QWidget *parent, NotebookTab *tab); NotebookTab *tab; std::pair removeFromLayout(ChatWidget *widget); void addToLayout(ChatWidget *widget, std::pair position); const std::vector & chatWidgets() const { return m_chatWidgets; } static bool isDraggingSplit; static ChatWidget *draggingSplit; static std::pair dropPosition; protected: void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void enterEvent(QEvent *); void leaveEvent(QEvent *); void mouseReleaseEvent(QMouseEvent *event); 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 position; DropRegion(QRect rect, std::pair position) { this->rect = rect; this->position = position; } }; QVBoxLayout m_parentbox; QHBoxLayout m_hbox; std::vector m_chatWidgets; std::vector m_dropRegions; NotebookPageDropPreview m_preview; private: void setPreviewRect(QPoint mousePos); }; #endif // NOTEBOOKPAGE_H