| #pragma once |
| |
| #ifndef SCREENBOARD_H |
| #define SCREENBOARD_H |
| |
| #include "tcommon.h" |
| |
| #include <QWidget> |
| #include <QList> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TOONZQT_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| namespace DVGui { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI ScreenBoard final : public QObject { |
| Q_OBJECT |
| |
| public: |
| class Drawing; |
| |
| private: |
| class ScreenWidget; |
| |
| QVector<ScreenWidget *> m_screenWidgets; |
| QList<Drawing *> m_drawings; |
| |
| QCursor m_cursor; |
| |
| bool m_grabbing; |
| bool m_mouseOnAScreen; |
| bool m_updated; |
| |
| public: |
| static ScreenBoard *instance(); |
| |
| const QList<Drawing *> &drawings() const { return m_drawings; } |
| QList<Drawing *> &drawings() { return m_drawings; } |
| |
| void grabMouse( |
| const QCursor &cursor); |
| void releaseMouse(); |
| |
| bool grabbingMouse() const { |
| return m_grabbing; |
| } |
| |
| private: |
| ScreenBoard(); |
| |
| void reallocScreenWidgets(); |
| void ensureMouseOnAScreen(); |
| |
| public slots: |
| |
| void update(); |
| |
| private slots: |
| |
| friend class ScreenWidget; |
| |
| void trackCursor(); |
| void doUpdate(); |
| }; |
| |
| |
| |
| |
| |
| |
| |
| class ScreenBoard::Drawing { |
| public: |
| |
| |
| |
| |
| |
| |
| virtual void event(QWidget *widget, QEvent *e) {} |
| |
| |
| |
| |
| virtual void paintEvent(QWidget *widget, QPaintEvent *pe) = 0; |
| |
| |
| |
| |
| |
| virtual bool acceptScreenEvents(const QRect &screenRect) const = 0; |
| }; |
| |
| } |
| |
| #endif |