#pragma once #include "widgets/chatwidget.hpp" #include "widgets/notebookpage.hpp" #include "widgets/notebookpagedroppreview.hpp" #include "widgets/notebooktab.hpp" #include #include #include #include #include #include #include #include namespace chatterino { namespace widgets { class NotebookPage : public QWidget { Q_OBJECT public: NotebookPage(QWidget *parent, NotebookTab *_tab); std::pair removeFromLayout(ChatWidget *widget); void addToLayout(ChatWidget *widget, std::pair position); const std::vector &getChatWidgets() const; NotebookTab *getTab() const; void addChat(bool openChannelNameDialog = false); static bool isDraggingSplit; static ChatWidget *draggingSplit; static std::pair dropPosition; protected: void paintEvent(QPaintEvent *) override; void enterEvent(QEvent *) override; void leaveEvent(QEvent *) override; void mouseReleaseEvent(QMouseEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override; void dragMoveEvent(QDragMoveEvent *event) override; void dragLeaveEvent(QDragLeaveEvent *event) override; void dropEvent(QDropEvent *event) override; private: struct DropRegion { QRect rect; std::pair position; DropRegion(QRect rect, std::pair position) { this->rect = rect; this->position = position; } }; NotebookTab *_tab; QVBoxLayout _parentbox; QHBoxLayout _hbox; std::vector _chatWidgets; std::vector _dropRegions; NotebookPageDropPreview _preview; void setPreviewRect(QPoint mousePos); std::pair getChatPosition(const ChatWidget *chatWidget); public: void load(const boost::property_tree::ptree &tree); boost::property_tree::ptree save(); }; } // namespace widgets } // namespace chatterino