1 /**
2 
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.nativescript;
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.script;
25 import godot.gdnativelibrary;
26 /**
27 
28 */
29 @GodotBaseClass struct NativeScript
30 {
31 	package(godot) enum string _GODOT_internal_name = "NativeScript";
32 public:
33 @nogc nothrow:
34 	union { /** */ godot_object _godot_object; /** */ Script _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_class_documentation") GodotMethod!(String) getClassDocumentation;
42 		@GodotName("get_class_name") GodotMethod!(String) getClassName;
43 		@GodotName("get_library") GodotMethod!(GDNativeLibrary) getLibrary;
44 		@GodotName("get_method_documentation") GodotMethod!(String, String) getMethodDocumentation;
45 		@GodotName("get_property_documentation") GodotMethod!(String, String) getPropertyDocumentation;
46 		@GodotName("get_script_class_icon_path") GodotMethod!(String) getScriptClassIconPath;
47 		@GodotName("get_script_class_name") GodotMethod!(String) getScriptClassName;
48 		@GodotName("get_signal_documentation") GodotMethod!(String, String) getSignalDocumentation;
49 		@GodotName("new") GodotMethod!(Variant, GodotVarArgs) _new;
50 		@GodotName("set_class_name") GodotMethod!(void, String) setClassName;
51 		@GodotName("set_library") GodotMethod!(void, GDNativeLibrary) setLibrary;
52 		@GodotName("set_script_class_icon_path") GodotMethod!(void, String) setScriptClassIconPath;
53 		@GodotName("set_script_class_name") GodotMethod!(void, String) setScriptClassName;
54 	}
55 	/// 
56 	pragma(inline, true) bool opEquals(in NativeScript other) const
57 	{ return _godot_object.ptr is other._godot_object.ptr; }
58 	/// 
59 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
60 	{ _godot_object.ptr = n; return null; }
61 	/// 
62 	pragma(inline, true) bool opEquals(typeof(null) n) const
63 	{ return _godot_object.ptr is n; }
64 	/// 
65 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
66 	mixin baseCasts;
67 	/// Construct a new instance of NativeScript.
68 	/// Note: use `memnew!NativeScript` instead.
69 	static NativeScript _new()
70 	{
71 		static godot_class_constructor constructor;
72 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("NativeScript");
73 		if(constructor is null) return typeof(this).init;
74 		return cast(NativeScript)(constructor());
75 	}
76 	@disable new(size_t s);
77 	/**
78 	Returns the documentation string that was previously set with `godot_nativescript_set_class_documentation`.
79 	*/
80 	String getClassDocumentation() const
81 	{
82 		checkClassBinding!(typeof(this))();
83 		return ptrcall!(String)(GDNativeClassBinding.getClassDocumentation, _godot_object);
84 	}
85 	/**
86 	
87 	*/
88 	String getClassName() const
89 	{
90 		checkClassBinding!(typeof(this))();
91 		return ptrcall!(String)(GDNativeClassBinding.getClassName, _godot_object);
92 	}
93 	/**
94 	
95 	*/
96 	Ref!GDNativeLibrary getLibrary() const
97 	{
98 		checkClassBinding!(typeof(this))();
99 		return ptrcall!(GDNativeLibrary)(GDNativeClassBinding.getLibrary, _godot_object);
100 	}
101 	/**
102 	Returns the documentation string that was previously set with `godot_nativescript_set_method_documentation`.
103 	*/
104 	String getMethodDocumentation(in String method) const
105 	{
106 		checkClassBinding!(typeof(this))();
107 		return ptrcall!(String)(GDNativeClassBinding.getMethodDocumentation, _godot_object, method);
108 	}
109 	/**
110 	Returns the documentation string that was previously set with `godot_nativescript_set_property_documentation`.
111 	*/
112 	String getPropertyDocumentation(in String path) const
113 	{
114 		checkClassBinding!(typeof(this))();
115 		return ptrcall!(String)(GDNativeClassBinding.getPropertyDocumentation, _godot_object, path);
116 	}
117 	/**
118 	
119 	*/
120 	String getScriptClassIconPath() const
121 	{
122 		checkClassBinding!(typeof(this))();
123 		return ptrcall!(String)(GDNativeClassBinding.getScriptClassIconPath, _godot_object);
124 	}
125 	/**
126 	
127 	*/
128 	String getScriptClassName() const
129 	{
130 		checkClassBinding!(typeof(this))();
131 		return ptrcall!(String)(GDNativeClassBinding.getScriptClassName, _godot_object);
132 	}
133 	/**
134 	Returns the documentation string that was previously set with `godot_nativescript_set_signal_documentation`.
135 	*/
136 	String getSignalDocumentation(in String signal_name) const
137 	{
138 		checkClassBinding!(typeof(this))();
139 		return ptrcall!(String)(GDNativeClassBinding.getSignalDocumentation, _godot_object, signal_name);
140 	}
141 	/**
142 	Constructs a new object of the base type with a script of this type already attached.
143 	$(I Note): Any arguments passed to this function will be ignored and not passed to the native constructor function. This will change with in a future API extension.
144 	*/
145 	Variant _new(VarArgs...)(VarArgs varArgs)
146 	{
147 		Array _GODOT_args = Array.make();
148 		foreach(vai, VA; VarArgs)
149 		{
150 			_GODOT_args.append(varArgs[vai]);
151 		}
152 		String _GODOT_method_name = String("new");
153 		return this.callv(_GODOT_method_name, _GODOT_args);
154 	}
155 	/**
156 	
157 	*/
158 	void setClassName(in String class_name)
159 	{
160 		checkClassBinding!(typeof(this))();
161 		ptrcall!(void)(GDNativeClassBinding.setClassName, _godot_object, class_name);
162 	}
163 	/**
164 	
165 	*/
166 	void setLibrary(GDNativeLibrary library)
167 	{
168 		checkClassBinding!(typeof(this))();
169 		ptrcall!(void)(GDNativeClassBinding.setLibrary, _godot_object, library);
170 	}
171 	/**
172 	
173 	*/
174 	void setScriptClassIconPath(in String icon_path)
175 	{
176 		checkClassBinding!(typeof(this))();
177 		ptrcall!(void)(GDNativeClassBinding.setScriptClassIconPath, _godot_object, icon_path);
178 	}
179 	/**
180 	
181 	*/
182 	void setScriptClassName(in String class_name)
183 	{
184 		checkClassBinding!(typeof(this))();
185 		ptrcall!(void)(GDNativeClassBinding.setScriptClassName, _godot_object, class_name);
186 	}
187 	/**
188 	
189 	*/
190 	@property String className()
191 	{
192 		return getClassName();
193 	}
194 	/// ditto
195 	@property void className(String v)
196 	{
197 		setClassName(v);
198 	}
199 	/**
200 	
201 	*/
202 	@property GDNativeLibrary library()
203 	{
204 		return getLibrary();
205 	}
206 	/// ditto
207 	@property void library(GDNativeLibrary v)
208 	{
209 		setLibrary(v);
210 	}
211 	/**
212 	
213 	*/
214 	@property String scriptClassIconPath()
215 	{
216 		return getScriptClassIconPath();
217 	}
218 	/// ditto
219 	@property void scriptClassIconPath(String v)
220 	{
221 		setScriptClassIconPath(v);
222 	}
223 	/**
224 	
225 	*/
226 	@property String scriptClassName()
227 	{
228 		return getScriptClassName();
229 	}
230 	/// ditto
231 	@property void scriptClassName(String v)
232 	{
233 		setScriptClassName(v);
234 	}
235 }