1 /**
2 Input event type for mouse button 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.inputeventmousebutton;
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.classdb;
24 import godot.inputeventmouse;
25 import godot.inputeventwithmodifiers;
26 /**
27 Input event type for mouse button events.
28 
29 Contains mouse click information. See $(D Node._input).
30 */
31 @GodotBaseClass struct InputEventMouseButton
32 {
33 	package(godot) enum string _GODOT_internal_name = "InputEventMouseButton";
34 public:
35 @nogc nothrow:
36 	union { /** */ godot_object _godot_object; /** */ InputEventMouse _GODOT_base; }
37 	alias _GODOT_base this;
38 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
39 	package(godot) __gshared bool _classBindingInitialized = false;
40 	package(godot) static struct GDNativeClassBinding
41 	{
42 		__gshared:
43 		@GodotName("get_button_index") GodotMethod!(long) getButtonIndex;
44 		@GodotName("get_factor") GodotMethod!(double) getFactor;
45 		@GodotName("is_doubleclick") GodotMethod!(bool) isDoubleclick;
46 		@GodotName("set_button_index") GodotMethod!(void, long) setButtonIndex;
47 		@GodotName("set_doubleclick") GodotMethod!(void, bool) setDoubleclick;
48 		@GodotName("set_factor") GodotMethod!(void, double) setFactor;
49 		@GodotName("set_pressed") GodotMethod!(void, bool) setPressed;
50 	}
51 	/// 
52 	pragma(inline, true) bool opEquals(in InputEventMouseButton other) const
53 	{ return _godot_object.ptr is other._godot_object.ptr; }
54 	/// 
55 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
56 	{ _godot_object.ptr = n; return null; }
57 	/// 
58 	pragma(inline, true) bool opEquals(typeof(null) n) const
59 	{ return _godot_object.ptr is n; }
60 	/// 
61 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
62 	mixin baseCasts;
63 	/// Construct a new instance of InputEventMouseButton.
64 	/// Note: use `memnew!InputEventMouseButton` instead.
65 	static InputEventMouseButton _new()
66 	{
67 		static godot_class_constructor constructor;
68 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventMouseButton");
69 		if(constructor is null) return typeof(this).init;
70 		return cast(InputEventMouseButton)(constructor());
71 	}
72 	@disable new(size_t s);
73 	/**
74 	
75 	*/
76 	long getButtonIndex() const
77 	{
78 		checkClassBinding!(typeof(this))();
79 		return ptrcall!(long)(GDNativeClassBinding.getButtonIndex, _godot_object);
80 	}
81 	/**
82 	
83 	*/
84 	double getFactor() const
85 	{
86 		checkClassBinding!(typeof(this))();
87 		return ptrcall!(double)(GDNativeClassBinding.getFactor, _godot_object);
88 	}
89 	/**
90 	
91 	*/
92 	bool isDoubleclick() const
93 	{
94 		checkClassBinding!(typeof(this))();
95 		return ptrcall!(bool)(GDNativeClassBinding.isDoubleclick, _godot_object);
96 	}
97 	/**
98 	
99 	*/
100 	void setButtonIndex(in long button_index)
101 	{
102 		checkClassBinding!(typeof(this))();
103 		ptrcall!(void)(GDNativeClassBinding.setButtonIndex, _godot_object, button_index);
104 	}
105 	/**
106 	
107 	*/
108 	void setDoubleclick(in bool doubleclick)
109 	{
110 		checkClassBinding!(typeof(this))();
111 		ptrcall!(void)(GDNativeClassBinding.setDoubleclick, _godot_object, doubleclick);
112 	}
113 	/**
114 	
115 	*/
116 	void setFactor(in double factor)
117 	{
118 		checkClassBinding!(typeof(this))();
119 		ptrcall!(void)(GDNativeClassBinding.setFactor, _godot_object, factor);
120 	}
121 	/**
122 	
123 	*/
124 	void setPressed(in bool pressed)
125 	{
126 		checkClassBinding!(typeof(this))();
127 		ptrcall!(void)(GDNativeClassBinding.setPressed, _godot_object, pressed);
128 	}
129 	/**
130 	The mouse button identifier, one of the $(D buttonlist) button or button wheel constants.
131 	*/
132 	@property long buttonIndex()
133 	{
134 		return getButtonIndex();
135 	}
136 	/// ditto
137 	@property void buttonIndex(long v)
138 	{
139 		setButtonIndex(v);
140 	}
141 	/**
142 	If `true`, the mouse button's state is a double-click.
143 	*/
144 	@property bool doubleclick()
145 	{
146 		return isDoubleclick();
147 	}
148 	/// ditto
149 	@property void doubleclick(bool v)
150 	{
151 		setDoubleclick(v);
152 	}
153 	/**
154 	The amount (or delta) of the event. When used for high-precision scroll events, this indicates the scroll amount (vertical or horizontal). This is only supported on some platforms; the reported sensitivity varies depending on the platform. May be `0` if not supported.
155 	*/
156 	@property double factor()
157 	{
158 		return getFactor();
159 	}
160 	/// ditto
161 	@property void factor(double v)
162 	{
163 		setFactor(v);
164 	}
165 	/**
166 	If `true`, the mouse button's state is pressed. If `false`, the mouse button's state is released.
167 	*/
168 	@property bool pressed()
169 	{
170 		return isPressed();
171 	}
172 	/// ditto
173 	@property void pressed(bool v)
174 	{
175 		setPressed(v);
176 	}
177 }