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