openPSTD  2.0
Open source simulation for sound propagation in urban environments
MouseHandlers.h
1 // This file is part of openPSTD. //
3 // //
4 // openPSTD is free software: you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation, either version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // openPSTD is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with openPSTD. If not, see <http://www.gnu.org/licenses/>. //
16 // //
18 
20 //
21 // Date: 17-08-2015
22 //
23 //
24 // Authors: M. R. Fortuin
25 //
26 //
27 // Purpose:
28 //
29 //
31 
32 #ifndef OPENPSTD_MOUSEHANDLERS_H
33 #define OPENPSTD_MOUSEHANDLERS_H
34 namespace OpenPSTD
35 {
36  namespace GUI
37  {
38  class MouseStrategy;
39 
40  class MouseVoidStrategy;
41 
42  class MouseMoveSceneStrategy;
43 
44  class MouseCreateDomainStrategy;
45 
46  class MouseCreateSpeakerReceiverStrategy;
47  }
48 }
49 
50 #include <memory>
51 #include "operations/BaseOperation.h"
52 #include <QVector2D>
53 #include <QtGui/qevent.h>
54 
55 namespace OpenPSTD
56 {
57  namespace GUI
58  {
60  {
61  protected:
62  std::shared_ptr<OperationRunner> operationRunner;
63 
64  public:
65  void SetOperationRunner(std::shared_ptr<OperationRunner> operationRunner);
66 
67  virtual void mousePressEvent(std::shared_ptr<Model> const &model, QMouseEvent *, QVector2D pos)
68  { };
69 
70  virtual void mouseReleaseEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent, QVector2D pos)
71  { };
72 
73  virtual void mouseMoveEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent, QVector2D pos)
74  { };
75 
76  virtual void wheelEvent(std::shared_ptr<Model> const &model, QWheelEvent *mouseEvent, QVector2D pos)
77  { };
78  };
79 
81  {
82  };
83 
85  {
86  public:
87  virtual void mouseReleaseEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent,
88  QVector2D pos) override;
89  };
90 
92  {
93  private:
94  QVector2D mousePos;
95  public:
96  virtual void mousePressEvent(std::shared_ptr<Model> const &model, QMouseEvent *, QVector2D pos) override;
97 
98  virtual void mouseMoveEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent,
99  QVector2D pos) override;
100 
101  virtual void wheelEvent(std::shared_ptr<Model> const &model, QWheelEvent *mouseEvent,
102  QVector2D pos) override;
103  };
104 
106  {
107  private:
108  QVector2D _start;
109  QVector2D _end;
110  public:
111  virtual void mousePressEvent(std::shared_ptr<Model> const &model, QMouseEvent *, QVector2D pos) override;
112 
113  virtual void mouseMoveEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent,
114  QVector2D pos) override;
115 
116  virtual void mouseReleaseEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent,
117  QVector2D pos) override;
118  };
119 
121  {
122  private:
123  PstdObjectType _type;
124  public:
125  MouseCreateSpeakerReceiverStrategy(PstdObjectType type);
126 
127  virtual void mouseMoveEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent,
128  QVector2D pos) override;
129 
130  virtual void mouseReleaseEvent(std::shared_ptr<Model> const &model, QMouseEvent *mouseEvent,
131  QVector2D pos) override;
132  };
133 
134  }
135 }
136 
137 #endif //OPENPSTD_MOUSEHANDLERS_H
138 
139 
This is the general namespace of the OpenPSTD application.
Definition: Boundary.cpp:33
Definition: MouseHandlers.h:80
Definition: MouseHandlers.h:105
Definition: MouseHandlers.h:91
Definition: MouseHandlers.h:84
Definition: MouseHandlers.h:59