1 /**
2 A GraphNode is a container with several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.
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.graphnode;
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.container;
24 import godot.inputevent;
25 import godot.texture;
26 import godot.control;
27 import godot.canvasitem;
28 import godot.node;
29 /**
30 A GraphNode is a container with several input and output slots allowing connections between GraphNodes. Slots can have different, incompatible types.
31 
32 A GraphNode is a container defined by a title. It can have 1 or more input and output slots, which can be enabled (shown) or disabled (not shown) and have different (incompatible) types. Colors can also be assigned to slots. A tuple of input and output slots is defined for each GUI element included in the GraphNode. Input and output connections are left and right slots, but only enabled slots are counted as connections.
33 */
34 @GodotBaseClass struct GraphNode
35 {
36 	enum string _GODOT_internal_name = "GraphNode";
37 public:
38 @nogc nothrow:
39 	union { godot_object _godot_object; Container _GODOT_base; }
40 	alias _GODOT_base this;
41 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
42 	package(godot) __gshared bool _classBindingInitialized = false;
43 	package(godot) static struct _classBinding
44 	{
45 		__gshared:
46 		@GodotName("set_title") GodotMethod!(void, String) setTitle;
47 		@GodotName("get_title") GodotMethod!(String) getTitle;
48 		@GodotName("_gui_input") GodotMethod!(void, InputEvent) _guiInput;
49 		@GodotName("set_slot") GodotMethod!(void, long, bool, long, Color, bool, long, Color, Texture, Texture) setSlot;
50 		@GodotName("clear_slot") GodotMethod!(void, long) clearSlot;
51 		@GodotName("clear_all_slots") GodotMethod!(void) clearAllSlots;
52 		@GodotName("is_slot_enabled_left") GodotMethod!(bool, long) isSlotEnabledLeft;
53 		@GodotName("get_slot_type_left") GodotMethod!(long, long) getSlotTypeLeft;
54 		@GodotName("get_slot_color_left") GodotMethod!(Color, long) getSlotColorLeft;
55 		@GodotName("is_slot_enabled_right") GodotMethod!(bool, long) isSlotEnabledRight;
56 		@GodotName("get_slot_type_right") GodotMethod!(long, long) getSlotTypeRight;
57 		@GodotName("get_slot_color_right") GodotMethod!(Color, long) getSlotColorRight;
58 		@GodotName("set_offset") GodotMethod!(void, Vector2) setOffset;
59 		@GodotName("get_offset") GodotMethod!(Vector2) getOffset;
60 		@GodotName("set_comment") GodotMethod!(void, bool) setComment;
61 		@GodotName("is_comment") GodotMethod!(bool) isComment;
62 		@GodotName("set_resizable") GodotMethod!(void, bool) setResizable;
63 		@GodotName("is_resizable") GodotMethod!(bool) isResizable;
64 		@GodotName("set_selected") GodotMethod!(void, bool) setSelected;
65 		@GodotName("is_selected") GodotMethod!(bool) isSelected;
66 		@GodotName("get_connection_output_count") GodotMethod!(long) getConnectionOutputCount;
67 		@GodotName("get_connection_input_count") GodotMethod!(long) getConnectionInputCount;
68 		@GodotName("get_connection_output_position") GodotMethod!(Vector2, long) getConnectionOutputPosition;
69 		@GodotName("get_connection_output_type") GodotMethod!(long, long) getConnectionOutputType;
70 		@GodotName("get_connection_output_color") GodotMethod!(Color, long) getConnectionOutputColor;
71 		@GodotName("get_connection_input_position") GodotMethod!(Vector2, long) getConnectionInputPosition;
72 		@GodotName("get_connection_input_type") GodotMethod!(long, long) getConnectionInputType;
73 		@GodotName("get_connection_input_color") GodotMethod!(Color, long) getConnectionInputColor;
74 		@GodotName("set_show_close_button") GodotMethod!(void, bool) setShowCloseButton;
75 		@GodotName("is_close_button_visible") GodotMethod!(bool) isCloseButtonVisible;
76 		@GodotName("set_overlay") GodotMethod!(void, long) setOverlay;
77 		@GodotName("get_overlay") GodotMethod!(GraphNode.Overlay) getOverlay;
78 	}
79 	bool opEquals(in GraphNode other) const { return _godot_object.ptr is other._godot_object.ptr; }
80 	GraphNode opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
81 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
82 	mixin baseCasts;
83 	static GraphNode _new()
84 	{
85 		static godot_class_constructor constructor;
86 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("GraphNode");
87 		if(constructor is null) return typeof(this).init;
88 		return cast(GraphNode)(constructor());
89 	}
90 	@disable new(size_t s);
91 	/// 
92 	enum Overlay : int
93 	{
94 		/**
95 		
96 		*/
97 		overlayDisabled = 0,
98 		/**
99 		
100 		*/
101 		overlayBreakpoint = 1,
102 		/**
103 		
104 		*/
105 		overlayPosition = 2,
106 	}
107 	/// 
108 	enum Constants : int
109 	{
110 		overlayDisabled = 0,
111 		overlayBreakpoint = 1,
112 		overlayPosition = 2,
113 	}
114 	/**
115 	
116 	*/
117 	void setTitle(StringArg0)(in StringArg0 title)
118 	{
119 		checkClassBinding!(typeof(this))();
120 		ptrcall!(void)(_classBinding.setTitle, _godot_object, title);
121 	}
122 	/**
123 	
124 	*/
125 	String getTitle() const
126 	{
127 		checkClassBinding!(typeof(this))();
128 		return ptrcall!(String)(_classBinding.getTitle, _godot_object);
129 	}
130 	/**
131 	
132 	*/
133 	void _guiInput(InputEvent arg0)
134 	{
135 		Array _GODOT_args = Array.empty_array;
136 		_GODOT_args.append(arg0);
137 		String _GODOT_method_name = String("_gui_input");
138 		this.callv(_GODOT_method_name, _GODOT_args);
139 	}
140 	/**
141 	
142 	*/
143 	void setSlot(in long idx, in bool enable_left, in long type_left, in Color color_left, in bool enable_right, in long type_right, in Color color_right, Texture custom_left = Texture.init, Texture custom_right = Texture.init)
144 	{
145 		checkClassBinding!(typeof(this))();
146 		ptrcall!(void)(_classBinding.setSlot, _godot_object, idx, enable_left, type_left, color_left, enable_right, type_right, color_right, custom_left, custom_right);
147 	}
148 	/**
149 	Disable input and output slot whose index is 'idx'.
150 	*/
151 	void clearSlot(in long idx)
152 	{
153 		checkClassBinding!(typeof(this))();
154 		ptrcall!(void)(_classBinding.clearSlot, _godot_object, idx);
155 	}
156 	/**
157 	Disable all input and output slots of the GraphNode.
158 	*/
159 	void clearAllSlots()
160 	{
161 		checkClassBinding!(typeof(this))();
162 		ptrcall!(void)(_classBinding.clearAllSlots, _godot_object);
163 	}
164 	/**
165 	Return true if left (input) slot 'idx' is enabled. False otherwise.
166 	*/
167 	bool isSlotEnabledLeft(in long idx) const
168 	{
169 		checkClassBinding!(typeof(this))();
170 		return ptrcall!(bool)(_classBinding.isSlotEnabledLeft, _godot_object, idx);
171 	}
172 	/**
173 	Return the (integer) type of left (input) 'idx' slot.
174 	*/
175 	long getSlotTypeLeft(in long idx) const
176 	{
177 		checkClassBinding!(typeof(this))();
178 		return ptrcall!(long)(_classBinding.getSlotTypeLeft, _godot_object, idx);
179 	}
180 	/**
181 	Return the color set to 'idx' left (input) slot.
182 	*/
183 	Color getSlotColorLeft(in long idx) const
184 	{
185 		checkClassBinding!(typeof(this))();
186 		return ptrcall!(Color)(_classBinding.getSlotColorLeft, _godot_object, idx);
187 	}
188 	/**
189 	Return true if right (output) slot 'idx' is enabled. False otherwise.
190 	*/
191 	bool isSlotEnabledRight(in long idx) const
192 	{
193 		checkClassBinding!(typeof(this))();
194 		return ptrcall!(bool)(_classBinding.isSlotEnabledRight, _godot_object, idx);
195 	}
196 	/**
197 	Return the (integer) type of right (output) 'idx' slot.
198 	*/
199 	long getSlotTypeRight(in long idx) const
200 	{
201 		checkClassBinding!(typeof(this))();
202 		return ptrcall!(long)(_classBinding.getSlotTypeRight, _godot_object, idx);
203 	}
204 	/**
205 	Return the color set to 'idx' right (output) slot.
206 	*/
207 	Color getSlotColorRight(in long idx) const
208 	{
209 		checkClassBinding!(typeof(this))();
210 		return ptrcall!(Color)(_classBinding.getSlotColorRight, _godot_object, idx);
211 	}
212 	/**
213 	
214 	*/
215 	void setOffset(in Vector2 offset)
216 	{
217 		checkClassBinding!(typeof(this))();
218 		ptrcall!(void)(_classBinding.setOffset, _godot_object, offset);
219 	}
220 	/**
221 	
222 	*/
223 	Vector2 getOffset() const
224 	{
225 		checkClassBinding!(typeof(this))();
226 		return ptrcall!(Vector2)(_classBinding.getOffset, _godot_object);
227 	}
228 	/**
229 	
230 	*/
231 	void setComment(in bool comment)
232 	{
233 		checkClassBinding!(typeof(this))();
234 		ptrcall!(void)(_classBinding.setComment, _godot_object, comment);
235 	}
236 	/**
237 	
238 	*/
239 	bool isComment() const
240 	{
241 		checkClassBinding!(typeof(this))();
242 		return ptrcall!(bool)(_classBinding.isComment, _godot_object);
243 	}
244 	/**
245 	
246 	*/
247 	void setResizable(in bool resizable)
248 	{
249 		checkClassBinding!(typeof(this))();
250 		ptrcall!(void)(_classBinding.setResizable, _godot_object, resizable);
251 	}
252 	/**
253 	
254 	*/
255 	bool isResizable() const
256 	{
257 		checkClassBinding!(typeof(this))();
258 		return ptrcall!(bool)(_classBinding.isResizable, _godot_object);
259 	}
260 	/**
261 	
262 	*/
263 	void setSelected(in bool selected)
264 	{
265 		checkClassBinding!(typeof(this))();
266 		ptrcall!(void)(_classBinding.setSelected, _godot_object, selected);
267 	}
268 	/**
269 	
270 	*/
271 	bool isSelected()
272 	{
273 		checkClassBinding!(typeof(this))();
274 		return ptrcall!(bool)(_classBinding.isSelected, _godot_object);
275 	}
276 	/**
277 	Return the number of enabled output slots (connections) of the GraphNode.
278 	*/
279 	long getConnectionOutputCount()
280 	{
281 		checkClassBinding!(typeof(this))();
282 		return ptrcall!(long)(_classBinding.getConnectionOutputCount, _godot_object);
283 	}
284 	/**
285 	Return the number of enabled input slots (connections) to the GraphNode.
286 	*/
287 	long getConnectionInputCount()
288 	{
289 		checkClassBinding!(typeof(this))();
290 		return ptrcall!(long)(_classBinding.getConnectionInputCount, _godot_object);
291 	}
292 	/**
293 	Return the position of the output connection 'idx'.
294 	*/
295 	Vector2 getConnectionOutputPosition(in long idx)
296 	{
297 		checkClassBinding!(typeof(this))();
298 		return ptrcall!(Vector2)(_classBinding.getConnectionOutputPosition, _godot_object, idx);
299 	}
300 	/**
301 	Return the type of the output connection 'idx'.
302 	*/
303 	long getConnectionOutputType(in long idx)
304 	{
305 		checkClassBinding!(typeof(this))();
306 		return ptrcall!(long)(_classBinding.getConnectionOutputType, _godot_object, idx);
307 	}
308 	/**
309 	Return the color of the output connection 'idx'.
310 	*/
311 	Color getConnectionOutputColor(in long idx)
312 	{
313 		checkClassBinding!(typeof(this))();
314 		return ptrcall!(Color)(_classBinding.getConnectionOutputColor, _godot_object, idx);
315 	}
316 	/**
317 	Return the position of the input connection 'idx'.
318 	*/
319 	Vector2 getConnectionInputPosition(in long idx)
320 	{
321 		checkClassBinding!(typeof(this))();
322 		return ptrcall!(Vector2)(_classBinding.getConnectionInputPosition, _godot_object, idx);
323 	}
324 	/**
325 	Return the type of the input connection 'idx'.
326 	*/
327 	long getConnectionInputType(in long idx)
328 	{
329 		checkClassBinding!(typeof(this))();
330 		return ptrcall!(long)(_classBinding.getConnectionInputType, _godot_object, idx);
331 	}
332 	/**
333 	Return the color of the input connection 'idx'.
334 	*/
335 	Color getConnectionInputColor(in long idx)
336 	{
337 		checkClassBinding!(typeof(this))();
338 		return ptrcall!(Color)(_classBinding.getConnectionInputColor, _godot_object, idx);
339 	}
340 	/**
341 	
342 	*/
343 	void setShowCloseButton(in bool show)
344 	{
345 		checkClassBinding!(typeof(this))();
346 		ptrcall!(void)(_classBinding.setShowCloseButton, _godot_object, show);
347 	}
348 	/**
349 	
350 	*/
351 	bool isCloseButtonVisible() const
352 	{
353 		checkClassBinding!(typeof(this))();
354 		return ptrcall!(bool)(_classBinding.isCloseButtonVisible, _godot_object);
355 	}
356 	/**
357 	
358 	*/
359 	void setOverlay(in long overlay)
360 	{
361 		checkClassBinding!(typeof(this))();
362 		ptrcall!(void)(_classBinding.setOverlay, _godot_object, overlay);
363 	}
364 	/**
365 	
366 	*/
367 	GraphNode.Overlay getOverlay() const
368 	{
369 		checkClassBinding!(typeof(this))();
370 		return ptrcall!(GraphNode.Overlay)(_classBinding.getOverlay, _godot_object);
371 	}
372 	/**
373 	
374 	*/
375 	@property String title()
376 	{
377 		return getTitle();
378 	}
379 	/// ditto
380 	@property void title(String v)
381 	{
382 		setTitle(v);
383 	}
384 	/**
385 	The offset of the GraphNode, relative to the scroll offset of the $(D GraphEdit). Note that you cannot use position directly, as $(D GraphEdit) is a $(D Container).
386 	*/
387 	@property Vector2 offset()
388 	{
389 		return getOffset();
390 	}
391 	/// ditto
392 	@property void offset(Vector2 v)
393 	{
394 		setOffset(v);
395 	}
396 	/**
397 	
398 	*/
399 	@property bool showClose()
400 	{
401 		return isCloseButtonVisible();
402 	}
403 	/// ditto
404 	@property void showClose(bool v)
405 	{
406 		setShowCloseButton(v);
407 	}
408 	/**
409 	
410 	*/
411 	@property bool resizable()
412 	{
413 		return isResizable();
414 	}
415 	/// ditto
416 	@property void resizable(bool v)
417 	{
418 		setResizable(v);
419 	}
420 	/**
421 	
422 	*/
423 	@property bool selected()
424 	{
425 		return isSelected();
426 	}
427 	/// ditto
428 	@property void selected(bool v)
429 	{
430 		setSelected(v);
431 	}
432 	/**
433 	
434 	*/
435 	@property bool comment()
436 	{
437 		return isComment();
438 	}
439 	/// ditto
440 	@property void comment(bool v)
441 	{
442 		setComment(v);
443 	}
444 	/**
445 	
446 	*/
447 	@property GraphNode.Overlay overlay()
448 	{
449 		return getOverlay();
450 	}
451 	/// ditto
452 	@property void overlay(long v)
453 	{
454 		setOverlay(v);
455 	}
456 }