Ignition Gui

API Reference

5.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 IGNITION_GUI_GUIEVENTS_HH_
18 #define IGNITION_GUI_GUIEVENTS_HH_
19 
20 #include <QEvent>
21 #include <string>
22 #include <utility>
23 #include <vector>
24 #include <ignition/math/Vector3.hh>
25 
26 namespace ignition
27 {
28  namespace gui
29  {
31  namespace events
32  {
35 
38  class Render : public QEvent
39  {
40  public: Render()
41  : QEvent(kType)
42  {
43  }
45  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser);
46  };
47 
51  class SnapIntervals : public QEvent
52  {
57  public: SnapIntervals(
58  const math::Vector3d &_xyz,
59  const math::Vector3d &_rpy,
60  const math::Vector3d &_scale)
61  : QEvent(kType), xyz(_xyz), rpy(_rpy), scale(_scale)
62  {
63  }
64 
67  public: math::Vector3d Position() const
68  {
69  return this->xyz;
70  }
71 
74  public: math::Vector3d Rotation() const
75  {
76  return this->rpy;
77  }
78 
81  public: math::Vector3d Scale() const
82  {
83  return this->scale;
84  }
85 
87  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 1);
88 
90  private: math::Vector3d xyz;
91 
94  private: math::Vector3d rpy;
95 
98  private: math::Vector3d scale;
99  };
100 
104  {
108  public: explicit SpawnFromDescription(const std::string &_description)
109  : QEvent(kType), description(_description)
110  {
111  }
112 
114  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 2);
115 
118  public: const std::string &Description() const
119  {
120  return this->description;
121  }
122 
125  };
126 
129  class SpawnFromPath : public QEvent
130  {
133  public: explicit SpawnFromPath(const std::string &_filePath)
134  : QEvent(kType), filePath(_filePath)
135  {
136  }
137 
139  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 3);
140 
143  public: const std::string &FilePath() const
144  {
145  return this->filePath;
146  }
147 
150  };
151 
154  class HoverToScene : public QEvent
155  {
159  public: explicit HoverToScene(const math::Vector3d &_point)
160  : QEvent(kType), point(_point)
161  {
162  }
163 
165  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 4);
166 
170  public: math::Vector3d Point() const
171  {
172  return this->point;
173  }
174 
176  private: math::Vector3d point;
177  };
178 
181  class LeftClickToScene : public QEvent
182  {
186  public: explicit LeftClickToScene(const math::Vector3d &_point)
187  : QEvent(kType), point(_point)
188  {
189  }
190 
192  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 5);
193 
196  public: math::Vector3d Point() const
197  {
198  return this->point;
199  }
200 
202  private: math::Vector3d point;
203  };
204 
207  class RightClickToScene : public QEvent
208  {
212  public: explicit RightClickToScene(const math::Vector3d &_point)
213  : QEvent(kType), point(_point)
214  {
215  }
216 
218  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 6);
219 
222  public: math::Vector3d Point() const
223  {
224  return this->point;
225  }
226 
228  private: math::Vector3d point;
229  };
230 
235  {
239  public: explicit DropdownMenuEnabled(bool _menuEnabled)
240  : QEvent(kType), menuEnabled(_menuEnabled)
241  {
242  }
243 
245  static const QEvent::Type kType = QEvent::Type(QEvent::MaxUser - 7);
246 
249  public: bool MenuEnabled() const
250  {
251  return this->menuEnabled;
252  }
253 
256  private: bool menuEnabled;
257  };
258  }
259  }
260 }
261 
262 #endif // IGNITION_GUI_GUIEVENTS_HH_
HoverToScene(const math::Vector3d &_point)
Constructor.
Definition: GuiEvents.hh:159
Event which is called to enable or disable the dropdown menu. This is primarily used by plugins which...
Definition: GuiEvents.hh:234
Event which is called to broadcast the 3D coordinates of a user&#39;s right click within the scene...
Definition: GuiEvents.hh:207
SpawnFromPath(const std::string &_filePath)
Constructor.
Definition: GuiEvents.hh:133
The class for sending and receiving custom snap value events. This event is used in the Transform Con...
Definition: GuiEvents.hh:51
Event called in the render thread of a 3D scene. It&#39;s safe to make rendering calls in this event&#39;s ca...
Definition: GuiEvents.hh:38
SpawnFromDescription(const std::string &_description)
Constructor.
Definition: GuiEvents.hh:108
Render()
Definition: GuiEvents.hh:40
math::Vector3d Position() const
Get the XYZ snapping values.
Definition: GuiEvents.hh:67
Event called to spawn a resource, given its description as a string.
Definition: GuiEvents.hh:103
STL class.
std::string description
The string of the resource to be spawned.
Definition: GuiEvents.hh:124
DropdownMenuEnabled(bool _menuEnabled)
Constructor.
Definition: GuiEvents.hh:239
math::Vector3d Point() const
Get the point within the scene that the user clicked.
Definition: GuiEvents.hh:196
math::Vector3d Scale() const
Get the scale snapping values.
Definition: GuiEvents.hh:81
RightClickToScene(const math::Vector3d &_point)
Constructor.
Definition: GuiEvents.hh:212
const std::string & Description() const
Get the string description of the resource.
Definition: GuiEvents.hh:118
math::Vector3d Point() const
Get the point within the scene that the user clicked.
Definition: GuiEvents.hh:222
math::Vector3d Point() const
Get the point within the scene over which the user is hovering.
Definition: GuiEvents.hh:170
static const QEvent::Type kType
Unique type for this event.
Definition: GuiEvents.hh:45
Event called to spawn a resource, which takes the path to its file.
Definition: GuiEvents.hh:129
LeftClickToScene(const math::Vector3d &_point)
Constructor.
Definition: GuiEvents.hh:186
Event which is called to broadcast the 3D coordinates of a user&#39;s left click within the scene...
Definition: GuiEvents.hh:181
bool MenuEnabled() const
Gets whether the menu is enabled or not for this event.
Definition: GuiEvents.hh:249
math::Vector3d Rotation() const
Get the RPY snapping values.
Definition: GuiEvents.hh:74
Definition: Application.hh:40
std::string filePath
The path of file to be previewed.
Definition: GuiEvents.hh:149
SnapIntervals(const math::Vector3d &_xyz, const math::Vector3d &_rpy, const math::Vector3d &_scale)
Constructor.
Definition: GuiEvents.hh:57
Event which is called to broadcast the 3D coordinates of a user&#39;s mouse hover within the scene...
Definition: GuiEvents.hh:154
const std::string & FilePath() const
Get the path of the file.
Definition: GuiEvents.hh:143