Gazebo Common

API Reference

4.7.0
gz/common/MouseEvent.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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_COMMON_MOUSEEVENT_HH_
18 #define GZ_COMMON_MOUSEEVENT_HH_
19 
20 #include <memory>
21 #include <gz/math/Vector2.hh>
22 
23 #include <gz/common/config.hh>
24 #include <gz/common/events/Export.hh>
26 
27 namespace ignition
28 {
29  namespace common
30  {
32  class MouseEventPrivate;
33 
36  class IGNITION_COMMON_EVENTS_VISIBLE MouseEvent
37  {
39  public: enum MouseButton
40  {
42  NO_BUTTON = 0x0,
43 
45  LEFT = 0x1,
46 
48  MIDDLE = 0x2,
49 
51  RIGHT = 0x4
52  };
53 
55  public: enum EventType
56  {
59 
62 
65 
68 
70  SCROLL
71  };
72 
74  public: MouseEvent();
75 
78  public: MouseEvent(const MouseEvent &_other);
79 
81  public: virtual ~MouseEvent();
82 
85  public: math::Vector2i Pos() const;
86 
89  public: void SetPos(const math::Vector2i &_pos);
90 
94  public: void SetPos(const int _x, const int _y);
95 
98  public: math::Vector2i PrevPos() const;
99 
102  public: void SetPrevPos(const math::Vector2i &_pos);
103 
107  public: void SetPrevPos(const int _x, const int _y);
108 
111  public: math::Vector2i PressPos() const;
112 
115  public: void SetPressPos(const math::Vector2i &_pos);
116 
120  public: void SetPressPos(const int _x, const int _y);
121 
124  public: math::Vector2i Scroll() const;
125 
128  public: void SetScroll(const math::Vector2i &_scroll);
129 
133  public: void SetScroll(const int _x, const int _y);
134 
137  public: float MoveScale() const;
138 
141  public: void SetMoveScale(const float _scale);
142 
146  public: bool Dragging() const;
147 
150  public: void SetDragging(const bool _dragging);
151 
154  public: EventType Type() const;
155 
158  public: void SetType(const EventType _type) const;
159 
162  public: MouseEvent::MouseButton Button() const;
163 
166  public: void SetButton(const MouseEvent::MouseButton _button) const;
167 
171  public: unsigned int Buttons() const;
172 
176  public: void SetButtons(const unsigned int &_buttons);
177 
180  public: bool Shift() const;
181 
184  public: void SetShift(const bool _shift) const;
185 
188  public: bool Alt() const;
189 
192  public: void SetAlt(const bool _alt);
193 
196  public: bool Control() const;
197 
200  public: void SetControl(const bool _control) const;
201 
205  public: MouseEvent &operator=(const MouseEvent &_other);
206 
210  private: std::unique_ptr<MouseEventPrivate> dataPtr;
212  };
213  }
214 }
215 #endif
Forward declarations for the common classes.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
Microsoft Visual Studio does not automatically export the interface information for member variables ...
Definition: gz/common/SuppressWarning.hh:65
@ NO_EVENT
No event.
Definition: gz/common/MouseEvent.hh:58
MouseButton
Standard mouse buttons enumeration.
Definition: gz/common/MouseEvent.hh:39
@ RELEASE
Release event.
Definition: gz/common/MouseEvent.hh:67
EventType
Mouse event types enumeration.
Definition: gz/common/MouseEvent.hh:55
@ PRESS
Press event.
Definition: gz/common/MouseEvent.hh:64
Generic description of a mouse event.
Definition: gz/common/MouseEvent.hh:36
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
Definition: gz/common/SuppressWarning.hh:68
@ MOVE
Move event.
Definition: gz/common/MouseEvent.hh:61