File indexing completed on 2024-05-19 04:07:50
0001 /* 0002 SPDX-FileCopyrightText: 2010 Stefan Majewsky <majewsky@gmx.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PALAPELI_INTERACTORMANAGER_H 0008 #define PALAPELI_INTERACTORMANAGER_H 0009 0010 #include <QGraphicsView> 0011 #include <QMap> 0012 0013 namespace Palapeli 0014 { 0015 struct EventContext; 0016 class Interactor; 0017 struct MouseEvent; 0018 0019 class InteractorManager : public QObject 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit InteractorManager(QGraphicsView* view); 0024 ~InteractorManager() override; 0025 0026 void handleEvent(QWheelEvent* event); 0027 void handleEvent(QMouseEvent* event); 0028 void handleEvent(QKeyEvent* event); 0029 0030 void updateScene(); 0031 public Q_SLOTS: 0032 void resetActiveTriggers(); 0033 protected: 0034 void handleEventCommon(const Palapeli::MouseEvent& pEvent, QMap<Palapeli::Interactor*, Palapeli::EventContext>& interactorData, Qt::MouseButtons unhandledButtons); 0035 private: 0036 QGraphicsView* m_view; 0037 QMap<QByteArray, Palapeli::Interactor*> m_interactors; //NOTE: The interactor list is always hard-coded, based on what is available. The keys are used for writing the trigger list to the config. 0038 //state 0039 Qt::MouseButtons m_buttons; 0040 QPoint m_mousePos; 0041 }; 0042 } 0043 0044 #endif // PALAPELI_INTERACTORMANAGER_H