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