Overte C++ Documentation
MouseEvent.h
1 //
2 // MouseEvent.h
3 // script-engine/src
4 //
5 // Created by Stephen Birarda on 2014-10-27.
6 // Copyright 2014 High Fidelity, Inc.
7 // Copyright 2023 Overte e.V.
8 //
9 // Distributed under the Apache License, Version 2.0.
10 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
11 // SPDX-License-Identifier: Apache-2.0
12 //
13 
16 
17 #ifndef hifi_MouseEvent_h
18 #define hifi_MouseEvent_h
19 
20 #include <QMouseEvent>
21 
22 #include "ScriptValue.h"
23 
24 class ScriptEngine;
25 
27 class MouseEvent {
28 public:
29  MouseEvent();
30  MouseEvent(const QMouseEvent& event);
31 
32  static ScriptValue toScriptValue(ScriptEngine* engine, const MouseEvent& event);
33  static bool fromScriptValue(const ScriptValue& object, MouseEvent& event);
34 
35  ScriptValue toScriptValue(ScriptEngine* engine) const { return MouseEvent::toScriptValue(engine, *this); }
36 
37  int x;
38  int y;
39  QString button;
40  bool isLeftButton;
41  bool isRightButton;
42  bool isMiddleButton;
43  bool isShifted;
44  bool isControl;
45  bool isMeta;
46  bool isAlt;
47 };
48 
49 Q_DECLARE_METATYPE(MouseEvent)
50 
51 #endif // hifi_MouseEvent_h
52 
Represents a mouse event to the scripting engine. Exposed as MouseEvent
Definition: MouseEvent.h:27
Provides an engine-independent interface for a scripting engine.
Definition: ScriptEngine.h:93
[ScriptInterface] Provides an engine-independent interface for QScriptValue
Definition: ScriptValue.h:40