1 /**
2 Base class for keys events with modifiers.
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.inputeventwithmodifiers;
14 import std.meta : AliasSeq, staticIndexOf;
15 import std.traits : Unqual;
16 import godot.d.meta;
17 import godot.core;
18 import godot.c;
19 import godot.d.bind;
20 import godot.d.reference;
21 import godot.object;
22 import godot.inputevent;
23 import godot.resource;
24 import godot.reference;
25 /**
26 Base class for keys events with modifiers.
27 
28 Contains keys events information with modifiers support like `SHIFT` or `ALT`. See $(D Node._input).
29 */
30 @GodotBaseClass struct InputEventWithModifiers
31 {
32 	enum string _GODOT_internal_name = "InputEventWithModifiers";
33 public:
34 @nogc nothrow:
35 	union { godot_object _godot_object; InputEvent _GODOT_base; }
36 	alias _GODOT_base this;
37 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
38 	package(godot) __gshared bool _classBindingInitialized = false;
39 	package(godot) static struct _classBinding
40 	{
41 		__gshared:
42 		@GodotName("set_alt") GodotMethod!(void, bool) setAlt;
43 		@GodotName("get_alt") GodotMethod!(bool) getAlt;
44 		@GodotName("set_shift") GodotMethod!(void, bool) setShift;
45 		@GodotName("get_shift") GodotMethod!(bool) getShift;
46 		@GodotName("set_control") GodotMethod!(void, bool) setControl;
47 		@GodotName("get_control") GodotMethod!(bool) getControl;
48 		@GodotName("set_metakey") GodotMethod!(void, bool) setMetakey;
49 		@GodotName("get_metakey") GodotMethod!(bool) getMetakey;
50 		@GodotName("set_command") GodotMethod!(void, bool) setCommand;
51 		@GodotName("get_command") GodotMethod!(bool) getCommand;
52 	}
53 	bool opEquals(in InputEventWithModifiers other) const { return _godot_object.ptr is other._godot_object.ptr; }
54 	InputEventWithModifiers opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
55 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
56 	mixin baseCasts;
57 	static InputEventWithModifiers _new()
58 	{
59 		static godot_class_constructor constructor;
60 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("InputEventWithModifiers");
61 		if(constructor is null) return typeof(this).init;
62 		return cast(InputEventWithModifiers)(constructor());
63 	}
64 	@disable new(size_t s);
65 	/**
66 	
67 	*/
68 	void setAlt(in bool enable)
69 	{
70 		checkClassBinding!(typeof(this))();
71 		ptrcall!(void)(_classBinding.setAlt, _godot_object, enable);
72 	}
73 	/**
74 	
75 	*/
76 	bool getAlt() const
77 	{
78 		checkClassBinding!(typeof(this))();
79 		return ptrcall!(bool)(_classBinding.getAlt, _godot_object);
80 	}
81 	/**
82 	
83 	*/
84 	void setShift(in bool enable)
85 	{
86 		checkClassBinding!(typeof(this))();
87 		ptrcall!(void)(_classBinding.setShift, _godot_object, enable);
88 	}
89 	/**
90 	
91 	*/
92 	bool getShift() const
93 	{
94 		checkClassBinding!(typeof(this))();
95 		return ptrcall!(bool)(_classBinding.getShift, _godot_object);
96 	}
97 	/**
98 	
99 	*/
100 	void setControl(in bool enable)
101 	{
102 		checkClassBinding!(typeof(this))();
103 		ptrcall!(void)(_classBinding.setControl, _godot_object, enable);
104 	}
105 	/**
106 	
107 	*/
108 	bool getControl() const
109 	{
110 		checkClassBinding!(typeof(this))();
111 		return ptrcall!(bool)(_classBinding.getControl, _godot_object);
112 	}
113 	/**
114 	
115 	*/
116 	void setMetakey(in bool enable)
117 	{
118 		checkClassBinding!(typeof(this))();
119 		ptrcall!(void)(_classBinding.setMetakey, _godot_object, enable);
120 	}
121 	/**
122 	
123 	*/
124 	bool getMetakey() const
125 	{
126 		checkClassBinding!(typeof(this))();
127 		return ptrcall!(bool)(_classBinding.getMetakey, _godot_object);
128 	}
129 	/**
130 	
131 	*/
132 	void setCommand(in bool enable)
133 	{
134 		checkClassBinding!(typeof(this))();
135 		ptrcall!(void)(_classBinding.setCommand, _godot_object, enable);
136 	}
137 	/**
138 	
139 	*/
140 	bool getCommand() const
141 	{
142 		checkClassBinding!(typeof(this))();
143 		return ptrcall!(bool)(_classBinding.getCommand, _godot_object);
144 	}
145 	/**
146 	State of the Alt modifier.
147 	*/
148 	@property bool alt()
149 	{
150 		return getAlt();
151 	}
152 	/// ditto
153 	@property void alt(bool v)
154 	{
155 		setAlt(v);
156 	}
157 	/**
158 	State of the Shift modifier.
159 	*/
160 	@property bool shift()
161 	{
162 		return getShift();
163 	}
164 	/// ditto
165 	@property void shift(bool v)
166 	{
167 		setShift(v);
168 	}
169 	/**
170 	State of the Ctrl modifier.
171 	*/
172 	@property bool control()
173 	{
174 		return getControl();
175 	}
176 	/// ditto
177 	@property void control(bool v)
178 	{
179 		setControl(v);
180 	}
181 	/**
182 	State of the Meta modifier.
183 	*/
184 	@property bool meta()
185 	{
186 		return getMetakey();
187 	}
188 	/// ditto
189 	@property void meta(bool v)
190 	{
191 		setMetakey(v);
192 	}
193 	/**
194 	State of the Command modifier.
195 	*/
196 	@property bool command()
197 	{
198 		return getCommand();
199 	}
200 	/// ditto
201 	@property void command(bool v)
202 	{
203 		setCommand(v);
204 	}
205 }