Gazebo Sim

API Reference

9.0.0
GuiEvents.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GZ_SIM_GUI_GUIEVENTS_HH_
18#define GZ_SIM_GUI_GUIEVENTS_HH_
19
20#include <QEvent>
21#include <QMap>
22#include <QString>
23
24#include <set>
25#include <string>
26#include <utility>
27#include <vector>
28
29#include <gz/math/Vector3.hh>
30#include <gz/utils/ImplPtr.hh>
31#include <sdf/Element.hh>
32#include <sdf/Plugin.hh>
33
34#include "gz/sim/gui/Export.hh"
35#include "gz/sim/Entity.hh"
36#include "gz/sim/config.hh"
37
38namespace gz
39{
40namespace sim
41{
42namespace gui {
43// Inline bracket to help doxygen filtering.
44inline namespace GZ_SIM_VERSION_NAMESPACE {
47namespace events
48{
50 class GZ_SIM_GUI_VISIBLE EntitiesSelected : public QEvent
51 {
56 public: explicit EntitiesSelected(
57 const std::vector<Entity> &_entities, // NOLINT
58 bool _fromUser = false)
59 : QEvent(kType), entities(_entities), fromUser(_fromUser)
60 {
61 }
62
65 public: std::vector<Entity> Data() const
66 {
67 return this->entities;
68 }
69
72 public: bool FromUser() const
73 {
74 return this->fromUser;
75 }
76
78 static const QEvent::Type kType = QEvent::Type(QEvent::User + 1);
79
81 private: std::vector<Entity> entities;
82
84 private: bool fromUser{false};
85 };
86
88 class GZ_SIM_GUI_VISIBLE DeselectAllEntities : public QEvent
89 {
93 public: explicit DeselectAllEntities(bool _fromUser = false)
94 : QEvent(kType), fromUser(_fromUser)
95 {
96 }
97
100 public: bool FromUser() const
101 {
102 return this->fromUser;
103 }
104
106 static const QEvent::Type kType = QEvent::Type(QEvent::User + 2);
107
109 private: bool fromUser{false};
110 };
111
115 class GZ_SIM_GUI_VISIBLE GuiNewRemovedEntities : public QEvent
116 {
120 public: GuiNewRemovedEntities(const std::set<Entity> &_newEntities,
121 const std::set<Entity> &_removedEntities);
122
124 public: const std::set<Entity> &NewEntities() const;
125
127 public: const std::set<Entity> &RemovedEntities() const;
128
130 static const QEvent::Type kType = QEvent::Type(QEvent::User + 3);
131
134 GZ_UTILS_IMPL_PTR(dataPtr)
135 };
136
141 class GZ_SIM_GUI_VISIBLE NewRemovedEntities : public QEvent
142 {
146 public: NewRemovedEntities(const std::set<Entity> &_newEntities,
147 const std::set<Entity> &_removedEntities);
148
150 public: const std::set<Entity> &NewEntities() const;
151
153 public: const std::set<Entity> &RemovedEntities() const;
154
156 static const QEvent::Type kType = QEvent::Type(QEvent::User + 4);
157
160 GZ_UTILS_IMPL_PTR(dataPtr)
161 };
162
165 class GZ_SIM_GUI_VISIBLE TransformControlModeActive : public QEvent
166 {
169 public: explicit TransformControlModeActive(const bool _tranformModeActive)
170 : QEvent(kType), tranformModeActive(_tranformModeActive)
171 {
172 }
173
175 static const QEvent::Type kType = QEvent::Type(QEvent::User + 6);
176
179 {
180 return this->tranformModeActive;
181 }
182
184 private: bool tranformModeActive;
185 };
186
188 class GZ_SIM_GUI_VISIBLE ModelEditorAddEntity : public QEvent
189 {
194 public: explicit ModelEditorAddEntity(QString _entity, QString _type,
195 gz::sim::Entity _parent);
196
198 public: QString Entity() const;
199
201 public: QString EntityType() const;
202
203
206
209 public: QMap<QString, QString> &Data();
210
211 static const QEvent::Type kType = QEvent::Type(QEvent::User + 7);
212
215 GZ_UTILS_IMPL_PTR(dataPtr)
216 };
217
219 class GZ_SIM_GUI_VISIBLE VisualPlugins: public QEvent
220 {
224 public: explicit VisualPlugins(gz::sim::Entity _entity,
225 const sdf::Plugins &_plugins);
226
228 public: gz::sim::Entity Entity() const;
229
231 public: const sdf::Plugins &Plugins() const;
232
233 static const QEvent::Type kType = QEvent::Type(QEvent::User + 9);
234
237 GZ_UTILS_IMPL_PTR(dataPtr)
238 };
239} // namespace events
240}
241} // namespace gui
242} // namespace sim
243} // namespace gz
244
245#endif // GZ_SIM_GUI_GUIEVENTS_HH_