1 /**
2 Base class for box containers.
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.boxcontainer;
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.container;
24 /**
25 Base class for box containers.
26 
27 Arranges child controls vertically or horizontally, and rearranges the controls automatically when their minimum size changes.
28 */
29 @GodotBaseClass struct BoxContainer
30 {
31 	package(godot) enum string _GODOT_internal_name = "BoxContainer";
32 public:
33 @nogc nothrow:
34 	union { /** */ godot_object _godot_object; /** */ Container _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("add_spacer") GodotMethod!(void, bool) addSpacer;
42 		@GodotName("get_alignment") GodotMethod!(BoxContainer.AlignMode) getAlignment;
43 		@GodotName("set_alignment") GodotMethod!(void, long) setAlignment;
44 	}
45 	/// 
46 	pragma(inline, true) bool opEquals(in BoxContainer other) const
47 	{ return _godot_object.ptr is other._godot_object.ptr; }
48 	/// 
49 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
50 	{ _godot_object.ptr = n; return null; }
51 	/// 
52 	pragma(inline, true) bool opEquals(typeof(null) n) const
53 	{ return _godot_object.ptr is n; }
54 	/// 
55 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
56 	mixin baseCasts;
57 	/// Construct a new instance of BoxContainer.
58 	/// Note: use `memnew!BoxContainer` instead.
59 	static BoxContainer _new()
60 	{
61 		static godot_class_constructor constructor;
62 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("BoxContainer");
63 		if(constructor is null) return typeof(this).init;
64 		return cast(BoxContainer)(constructor());
65 	}
66 	@disable new(size_t s);
67 	/// 
68 	enum AlignMode : int
69 	{
70 		/**
71 		Aligns children with the beginning of the container.
72 		*/
73 		alignBegin = 0,
74 		/**
75 		Aligns children with the center of the container.
76 		*/
77 		alignCenter = 1,
78 		/**
79 		Aligns children with the end of the container.
80 		*/
81 		alignEnd = 2,
82 	}
83 	/// 
84 	enum Constants : int
85 	{
86 		alignBegin = 0,
87 		alignCenter = 1,
88 		alignEnd = 2,
89 	}
90 	/**
91 	Adds a control to the box as a spacer. If `true`, `begin` will insert the spacer control in front of other children.
92 	*/
93 	void addSpacer(in bool begin)
94 	{
95 		checkClassBinding!(typeof(this))();
96 		ptrcall!(void)(GDNativeClassBinding.addSpacer, _godot_object, begin);
97 	}
98 	/**
99 	
100 	*/
101 	BoxContainer.AlignMode getAlignment() const
102 	{
103 		checkClassBinding!(typeof(this))();
104 		return ptrcall!(BoxContainer.AlignMode)(GDNativeClassBinding.getAlignment, _godot_object);
105 	}
106 	/**
107 	
108 	*/
109 	void setAlignment(in long alignment)
110 	{
111 		checkClassBinding!(typeof(this))();
112 		ptrcall!(void)(GDNativeClassBinding.setAlignment, _godot_object, alignment);
113 	}
114 	/**
115 	The alignment of the container's children (must be one of $(D constant ALIGN_BEGIN), $(D constant ALIGN_CENTER) or $(D constant ALIGN_END)).
116 	*/
117 	@property BoxContainer.AlignMode alignment()
118 	{
119 		return getAlignment();
120 	}
121 	/// ditto
122 	@property void alignment(long v)
123 	{
124 		setAlignment(v);
125 	}
126 }