Gazebo Common

API Reference

6.0.0~pre2
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/events/Export.hh>
24#include <gz/utils/SuppressWarning.hh>
25
26namespace gz
27{
28 namespace common
29 {
31 class MouseEventPrivate;
32
35 class GZ_COMMON_EVENTS_VISIBLE MouseEvent
36 {
38 public: enum MouseButton
39 {
41 NO_BUTTON = 0x0,
42
44 LEFT = 0x1,
45
47 MIDDLE = 0x2,
48
50 RIGHT = 0x4
51 };
52
54 public: enum EventType
55 {
58
61
64
67
69 SCROLL
70 };
71
73 public: MouseEvent();
74
77 public: MouseEvent(const MouseEvent &_other);
78
80 public: virtual ~MouseEvent();
81
84 public: math::Vector2i Pos() const;
85
88 public: void SetPos(const math::Vector2i &_pos);
89
93 public: void SetPos(int _x, int _y);
94
97 public: math::Vector2i PrevPos() const;
98
101 public: void SetPrevPos(const math::Vector2i &_pos);
102
106 public: void SetPrevPos(int _x, int _y);
107
110 public: math::Vector2i PressPos() const;
111
114 public: void SetPressPos(const math::Vector2i &_pos);
115
119 public: void SetPressPos(int _x, int _y);
120
123 public: math::Vector2i Scroll() const;
124
127 public: void SetScroll(const math::Vector2i &_scroll);
128
132 public: void SetScroll(int _x, int _y);
133
136 public: float MoveScale() const;
137
140 public: void SetMoveScale(float _scale);
141
145 public: bool Dragging() const;
146
149 public: void SetDragging(bool _dragging);
150
153 public: EventType Type() const;
154
157 public: void SetType(MouseEvent::EventType _type);
158
162
165 public: void SetButton(MouseEvent::MouseButton _button);
166
170 public: unsigned int Buttons() const;
171
175 public: void SetButtons(unsigned int _buttons);
176
179 public: bool Shift() const;
180
183 public: void SetShift(bool _shift);
184
187 public: bool Alt() const;
188
191 public: void SetAlt(bool _alt);
192
195 public: bool Control() const;
196
199 public: void SetControl(bool _control);
200
204 public: MouseEvent &operator=(const MouseEvent &_other);
205
206 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
209 private: std::unique_ptr<MouseEventPrivate> dataPtr;
210 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
211 };
212 }
213}
214#endif