1 /**
2 Container for splitting and adjusting.
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.splitcontainer;
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 import godot.control;
25 import godot.canvasitem;
26 import godot.node;
27 import godot.inputevent;
28 /**
29 Container for splitting and adjusting.
30 
31 Container for splitting two $(D Control)s vertically or horizontally, with a grabber that allows adjusting the split offset or ratio.
32 */
33 @GodotBaseClass struct SplitContainer
34 {
35 	package(godot) enum string _GODOT_internal_name = "SplitContainer";
36 public:
37 @nogc nothrow:
38 	union { /** */ godot_object _godot_object; /** */ Container _GODOT_base; }
39 	alias _GODOT_base this;
40 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
41 	package(godot) __gshared bool _classBindingInitialized = false;
42 	package(godot) static struct GDNativeClassBinding
43 	{
44 		__gshared:
45 		@GodotName("_gui_input") GodotMethod!(void, InputEvent) _guiInput;
46 		@GodotName("clamp_split_offset") GodotMethod!(void) clampSplitOffset;
47 		@GodotName("get_dragger_visibility") GodotMethod!(SplitContainer.DraggerVisibility) getDraggerVisibility;
48 		@GodotName("get_split_offset") GodotMethod!(long) getSplitOffset;
49 		@GodotName("is_collapsed") GodotMethod!(bool) isCollapsed;
50 		@GodotName("set_collapsed") GodotMethod!(void, bool) setCollapsed;
51 		@GodotName("set_dragger_visibility") GodotMethod!(void, long) setDraggerVisibility;
52 		@GodotName("set_split_offset") GodotMethod!(void, long) setSplitOffset;
53 	}
54 	/// 
55 	pragma(inline, true) bool opEquals(in SplitContainer other) const
56 	{ return _godot_object.ptr is other._godot_object.ptr; }
57 	/// 
58 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
59 	{ _godot_object.ptr = n; return null; }
60 	/// 
61 	pragma(inline, true) bool opEquals(typeof(null) n) const
62 	{ return _godot_object.ptr is n; }
63 	/// 
64 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
65 	mixin baseCasts;
66 	/// Construct a new instance of SplitContainer.
67 	/// Note: use `memnew!SplitContainer` instead.
68 	static SplitContainer _new()
69 	{
70 		static godot_class_constructor constructor;
71 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("SplitContainer");
72 		if(constructor is null) return typeof(this).init;
73 		return cast(SplitContainer)(constructor());
74 	}
75 	@disable new(size_t s);
76 	/// 
77 	enum DraggerVisibility : int
78 	{
79 		/**
80 		The split dragger is visible when the cursor hovers it.
81 		*/
82 		draggerVisible = 0,
83 		/**
84 		The split dragger is never visible.
85 		*/
86 		draggerHidden = 1,
87 		/**
88 		The split dragger is never visible and its space collapsed.
89 		*/
90 		draggerHiddenCollapsed = 2,
91 	}
92 	/// 
93 	enum Constants : int
94 	{
95 		draggerVisible = 0,
96 		draggerHidden = 1,
97 		draggerHiddenCollapsed = 2,
98 	}
99 	/**
100 	
101 	*/
102 	void _guiInput(InputEvent arg0)
103 	{
104 		Array _GODOT_args = Array.make();
105 		_GODOT_args.append(arg0);
106 		String _GODOT_method_name = String("_gui_input");
107 		this.callv(_GODOT_method_name, _GODOT_args);
108 	}
109 	/**
110 	Clamps the $(D splitOffset) value to not go outside the currently possible minimal and maximum values.
111 	*/
112 	void clampSplitOffset()
113 	{
114 		checkClassBinding!(typeof(this))();
115 		ptrcall!(void)(GDNativeClassBinding.clampSplitOffset, _godot_object);
116 	}
117 	/**
118 	
119 	*/
120 	SplitContainer.DraggerVisibility getDraggerVisibility() const
121 	{
122 		checkClassBinding!(typeof(this))();
123 		return ptrcall!(SplitContainer.DraggerVisibility)(GDNativeClassBinding.getDraggerVisibility, _godot_object);
124 	}
125 	/**
126 	
127 	*/
128 	long getSplitOffset() const
129 	{
130 		checkClassBinding!(typeof(this))();
131 		return ptrcall!(long)(GDNativeClassBinding.getSplitOffset, _godot_object);
132 	}
133 	/**
134 	
135 	*/
136 	bool isCollapsed() const
137 	{
138 		checkClassBinding!(typeof(this))();
139 		return ptrcall!(bool)(GDNativeClassBinding.isCollapsed, _godot_object);
140 	}
141 	/**
142 	
143 	*/
144 	void setCollapsed(in bool collapsed)
145 	{
146 		checkClassBinding!(typeof(this))();
147 		ptrcall!(void)(GDNativeClassBinding.setCollapsed, _godot_object, collapsed);
148 	}
149 	/**
150 	
151 	*/
152 	void setDraggerVisibility(in long mode)
153 	{
154 		checkClassBinding!(typeof(this))();
155 		ptrcall!(void)(GDNativeClassBinding.setDraggerVisibility, _godot_object, mode);
156 	}
157 	/**
158 	
159 	*/
160 	void setSplitOffset(in long offset)
161 	{
162 		checkClassBinding!(typeof(this))();
163 		ptrcall!(void)(GDNativeClassBinding.setSplitOffset, _godot_object, offset);
164 	}
165 	/**
166 	If `true`, the area of the first $(D Control) will be collapsed and the dragger will be disabled.
167 	*/
168 	@property bool collapsed()
169 	{
170 		return isCollapsed();
171 	}
172 	/// ditto
173 	@property void collapsed(bool v)
174 	{
175 		setCollapsed(v);
176 	}
177 	/**
178 	Determines the dragger's visibility. See $(D draggervisibility) for details.
179 	*/
180 	@property SplitContainer.DraggerVisibility draggerVisibility()
181 	{
182 		return getDraggerVisibility();
183 	}
184 	/// ditto
185 	@property void draggerVisibility(long v)
186 	{
187 		setDraggerVisibility(v);
188 	}
189 	/**
190 	The initial offset of the splitting between the two $(D Control)s, with `0` being at the end of the first $(D Control).
191 	*/
192 	@property long splitOffset()
193 	{
194 		return getSplitOffset();
195 	}
196 	/// ditto
197 	@property void splitOffset(long v)
198 	{
199 		setSplitOffset(v);
200 	}
201 }