1 /**
2 Base input event type for mouse events.
3 
4 Copyright:
5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur.  
6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md)  
7 Copyright (c) 2017-2018 Godot-D contributors  
8 
9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License)
10 
11 
12 */
13 module godot.inputeventmouse;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.traits;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.globalenums;
22 import godot.object;
23 import godot.inputeventwithmodifiers;
24 /**
25 Base input event type for mouse events.
26 
27 Stores general mouse events information.
28 */
29 @GodotBaseClass struct InputEventMouse
30 {
31 	package(godot) enum string _GODOT_internal_name = "InputEventMouse";
32 public:
33 @nogc nothrow:
34 	union { /** */ godot_object _godot_object; /** */ InputEventWithModifiers _GODOT_base; }
35 	alias _GODOT_base this;
36 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
37 	package(godot) __gshared bool _classBindingInitialized = false;
38 	package(godot) static struct GDNativeClassBinding
39 	{
40 		__gshared:
41 		@GodotName("get_button_mask") GodotMethod!(long) getButtonMask;
42 		@GodotName("get_global_position") GodotMethod!(Vector2) getGlobalPosition;
43 		@GodotName("get_position") GodotMethod!(Vector2) getPosition;
44 		@GodotName("set_button_mask") GodotMethod!(void, long) setButtonMask;
45 		@GodotName("set_global_position") GodotMethod!(void, Vector2) setGlobalPosition;
46 		@GodotName("set_position") GodotMethod!(void, Vector2) setPosition;
47 	}
48 	/// 
49 	pragma(inline, true) bool opEquals(in InputEventMouse other) const
50 	{ return _godot_object.ptr is other._godot_object.ptr; }
51 	/// 
52 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
53 	{ _godot_object.ptr = n; return null; }
54 	/// 
55 	pragma(inline, true) bool opEquals(typeof(null) n) const
56 	{ return _godot_object.ptr is n; }
57 	/// 
58 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
59 	mixin baseCasts;
60 	/// Construct a new instance of InputEventMouse.
61 	/// Note: use `memnew!InputEventMouse` instead.
62 	static InputEventMouse _new()
63 	{
64 		static godot_class_constructor constructor;
65 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventMouse");
66 		if(constructor is null) return typeof(this).init;
67 		return cast(InputEventMouse)(constructor());
68 	}
69 	@disable new(size_t s);
70 	/**
71 	
72 	*/
73 	long getButtonMask() const
74 	{
75 		checkClassBinding!(typeof(this))();
76 		return ptrcall!(long)(GDNativeClassBinding.getButtonMask, _godot_object);
77 	}
78 	/**
79 	
80 	*/
81 	Vector2 getGlobalPosition() const
82 	{
83 		checkClassBinding!(typeof(this))();
84 		return ptrcall!(Vector2)(GDNativeClassBinding.getGlobalPosition, _godot_object);
85 	}
86 	/**
87 	
88 	*/
89 	Vector2 getPosition() const
90 	{
91 		checkClassBinding!(typeof(this))();
92 		return ptrcall!(Vector2)(GDNativeClassBinding.getPosition, _godot_object);
93 	}
94 	/**
95 	
96 	*/
97 	void setButtonMask(in long button_mask)
98 	{
99 		checkClassBinding!(typeof(this))();
100 		ptrcall!(void)(GDNativeClassBinding.setButtonMask, _godot_object, button_mask);
101 	}
102 	/**
103 	
104 	*/
105 	void setGlobalPosition(in Vector2 global_position)
106 	{
107 		checkClassBinding!(typeof(this))();
108 		ptrcall!(void)(GDNativeClassBinding.setGlobalPosition, _godot_object, global_position);
109 	}
110 	/**
111 	
112 	*/
113 	void setPosition(in Vector2 position)
114 	{
115 		checkClassBinding!(typeof(this))();
116 		ptrcall!(void)(GDNativeClassBinding.setPosition, _godot_object, position);
117 	}
118 	/**
119 	The mouse button mask identifier, one of or a bitwise combination of the $(D buttonlist) button masks.
120 	*/
121 	@property long buttonMask()
122 	{
123 		return getButtonMask();
124 	}
125 	/// ditto
126 	@property void buttonMask(long v)
127 	{
128 		setButtonMask(v);
129 	}
130 	/**
131 	The global mouse position relative to the current $(D Viewport) when used in $(D Control._guiInput), otherwise is at 0,0.
132 	*/
133 	@property Vector2 globalPosition()
134 	{
135 		return getGlobalPosition();
136 	}
137 	/// ditto
138 	@property void globalPosition(Vector2 v)
139 	{
140 		setGlobalPosition(v);
141 	}
142 	/**
143 	The local mouse position relative to the $(D Viewport). If used in $(D Control._guiInput), the position is relative to the current $(D Control) which is under the mouse.
144 	*/
145 	@property Vector2 position()
146 	{
147 		return getPosition();
148 	}
149 	/// ditto
150 	@property void position(Vector2 v)
151 	{
152 		setPosition(v);
153 	}
154 }