1 /**
2 Theme for controls.
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.theme;
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.resource;
24 import godot.texture;
25 import godot.stylebox;
26 import godot.font;
27 import godot.reference;
28 /**
29 Theme for controls.
30 
31 Theme for skinning controls. Controls can be skinned individually, but for complex applications it's more efficient to just create a global theme that defines everything. This theme can be applied to any $(D Control), and it and its children will automatically use it.
32 Theme resources can be alternatively loaded by writing them in a .theme file, see docs for more info.
33 */
34 @GodotBaseClass struct Theme
35 {
36 	enum string _GODOT_internal_name = "Theme";
37 public:
38 @nogc nothrow:
39 	union { godot_object _godot_object; Resource _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_icon") GodotMethod!(void, String, String, Texture) setIcon;
47 		@GodotName("get_icon") GodotMethod!(Texture, String, String) getIcon;
48 		@GodotName("has_icon") GodotMethod!(bool, String, String) hasIcon;
49 		@GodotName("clear_icon") GodotMethod!(void, String, String) clearIcon;
50 		@GodotName("get_icon_list") GodotMethod!(PoolStringArray, String) getIconList;
51 		@GodotName("set_stylebox") GodotMethod!(void, String, String, StyleBox) setStylebox;
52 		@GodotName("get_stylebox") GodotMethod!(StyleBox, String, String) getStylebox;
53 		@GodotName("has_stylebox") GodotMethod!(bool, String, String) hasStylebox;
54 		@GodotName("clear_stylebox") GodotMethod!(void, String, String) clearStylebox;
55 		@GodotName("get_stylebox_list") GodotMethod!(PoolStringArray, String) getStyleboxList;
56 		@GodotName("get_stylebox_types") GodotMethod!(PoolStringArray) getStyleboxTypes;
57 		@GodotName("set_font") GodotMethod!(void, String, String, Font) setFont;
58 		@GodotName("get_font") GodotMethod!(Font, String, String) getFont;
59 		@GodotName("has_font") GodotMethod!(bool, String, String) hasFont;
60 		@GodotName("clear_font") GodotMethod!(void, String, String) clearFont;
61 		@GodotName("get_font_list") GodotMethod!(PoolStringArray, String) getFontList;
62 		@GodotName("set_color") GodotMethod!(void, String, String, Color) setColor;
63 		@GodotName("get_color") GodotMethod!(Color, String, String) getColor;
64 		@GodotName("has_color") GodotMethod!(bool, String, String) hasColor;
65 		@GodotName("clear_color") GodotMethod!(void, String, String) clearColor;
66 		@GodotName("get_color_list") GodotMethod!(PoolStringArray, String) getColorList;
67 		@GodotName("set_constant") GodotMethod!(void, String, String, long) setConstant;
68 		@GodotName("get_constant") GodotMethod!(long, String, String) getConstant;
69 		@GodotName("has_constant") GodotMethod!(bool, String, String) hasConstant;
70 		@GodotName("clear_constant") GodotMethod!(void, String, String) clearConstant;
71 		@GodotName("get_constant_list") GodotMethod!(PoolStringArray, String) getConstantList;
72 		@GodotName("set_default_font") GodotMethod!(void, Font) setDefaultFont;
73 		@GodotName("get_default_font") GodotMethod!(Font) getDefaultFont;
74 		@GodotName("get_type_list") GodotMethod!(PoolStringArray, String) getTypeList;
75 		@GodotName("_emit_theme_changed") GodotMethod!(void) _emitThemeChanged;
76 		@GodotName("copy_default_theme") GodotMethod!(void) copyDefaultTheme;
77 	}
78 	bool opEquals(in Theme other) const { return _godot_object.ptr is other._godot_object.ptr; }
79 	Theme opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
80 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
81 	mixin baseCasts;
82 	static Theme _new()
83 	{
84 		static godot_class_constructor constructor;
85 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Theme");
86 		if(constructor is null) return typeof(this).init;
87 		return cast(Theme)(constructor());
88 	}
89 	@disable new(size_t s);
90 	/**
91 	Sets Theme's icon $(D Texture) to `texture` at `name` in `type`.
92 	Does nothing if Theme does not have `type`.
93 	*/
94 	void setIcon(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type, Texture texture)
95 	{
96 		checkClassBinding!(typeof(this))();
97 		ptrcall!(void)(_classBinding.setIcon, _godot_object, name, type, texture);
98 	}
99 	/**
100 	Returns the icon $(D Texture) at `name` if Theme has `type`.
101 	*/
102 	Ref!Texture getIcon(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
103 	{
104 		checkClassBinding!(typeof(this))();
105 		return ptrcall!(Texture)(_classBinding.getIcon, _godot_object, name, type);
106 	}
107 	/**
108 	Returns `true` if icon $(D Texture) with `name` is in `type`.
109 	Returns `false` if Theme does not have `type`.
110 	*/
111 	bool hasIcon(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
112 	{
113 		checkClassBinding!(typeof(this))();
114 		return ptrcall!(bool)(_classBinding.hasIcon, _godot_object, name, type);
115 	}
116 	/**
117 	Clears icon at `name` if Theme has `type`.
118 	*/
119 	void clearIcon(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type)
120 	{
121 		checkClassBinding!(typeof(this))();
122 		ptrcall!(void)(_classBinding.clearIcon, _godot_object, name, type);
123 	}
124 	/**
125 	Returns all of the icons as a $(D PoolStringArray) filled with each $(D Texture)'s name, for use in $(D getIcon), if Theme has `type`.
126 	*/
127 	PoolStringArray getIconList(StringArg0)(in StringArg0 type) const
128 	{
129 		checkClassBinding!(typeof(this))();
130 		return ptrcall!(PoolStringArray)(_classBinding.getIconList, _godot_object, type);
131 	}
132 	/**
133 	Sets Theme's $(D StyleBox) to `stylebox` at `name` in `type`.
134 	Does nothing if Theme does not have `type`.
135 	*/
136 	void setStylebox(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type, StyleBox texture)
137 	{
138 		checkClassBinding!(typeof(this))();
139 		ptrcall!(void)(_classBinding.setStylebox, _godot_object, name, type, texture);
140 	}
141 	/**
142 	Returns the icon $(D StyleBox) at `name` if Theme has `type`.
143 	*/
144 	Ref!StyleBox getStylebox(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
145 	{
146 		checkClassBinding!(typeof(this))();
147 		return ptrcall!(StyleBox)(_classBinding.getStylebox, _godot_object, name, type);
148 	}
149 	/**
150 	Returns `true` if $(D StyleBox) with `name` is in `type`.
151 	Returns `false` if Theme does not have `type`.
152 	*/
153 	bool hasStylebox(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
154 	{
155 		checkClassBinding!(typeof(this))();
156 		return ptrcall!(bool)(_classBinding.hasStylebox, _godot_object, name, type);
157 	}
158 	/**
159 	Clears $(D StyleBox) at `name` if Theme has `type`.
160 	*/
161 	void clearStylebox(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type)
162 	{
163 		checkClassBinding!(typeof(this))();
164 		ptrcall!(void)(_classBinding.clearStylebox, _godot_object, name, type);
165 	}
166 	/**
167 	Returns all of the $(D StyleBox)s as a $(D PoolStringArray) filled with each $(D StyleBox)'s name, for use in $(D getStylebox), if Theme has `type`.
168 	*/
169 	PoolStringArray getStyleboxList(StringArg0)(in StringArg0 type) const
170 	{
171 		checkClassBinding!(typeof(this))();
172 		return ptrcall!(PoolStringArray)(_classBinding.getStyleboxList, _godot_object, type);
173 	}
174 	/**
175 	Returns all of the $(D StyleBox) types as a $(D PoolStringArray) filled with each $(D StyleBox)'s type, for use in $(D getStylebox) and/or $(D getStyleboxList), if Theme has `type`.
176 	*/
177 	PoolStringArray getStyleboxTypes() const
178 	{
179 		checkClassBinding!(typeof(this))();
180 		return ptrcall!(PoolStringArray)(_classBinding.getStyleboxTypes, _godot_object);
181 	}
182 	/**
183 	Sets Theme's $(D Font) to `font` at `name` in `type`.
184 	Does nothing if Theme does not have `type`.
185 	*/
186 	void setFont(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type, Font font)
187 	{
188 		checkClassBinding!(typeof(this))();
189 		ptrcall!(void)(_classBinding.setFont, _godot_object, name, type, font);
190 	}
191 	/**
192 	Returns the $(D Font) at `name` if Theme has `type`.
193 	*/
194 	Ref!Font getFont(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
195 	{
196 		checkClassBinding!(typeof(this))();
197 		return ptrcall!(Font)(_classBinding.getFont, _godot_object, name, type);
198 	}
199 	/**
200 	Returns `true` if $(D Font) with `name` is in `type`.
201 	Returns `false` if Theme does not have `type`.
202 	*/
203 	bool hasFont(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
204 	{
205 		checkClassBinding!(typeof(this))();
206 		return ptrcall!(bool)(_classBinding.hasFont, _godot_object, name, type);
207 	}
208 	/**
209 	Clears $(D Font) at `name` if Theme has `type`.
210 	*/
211 	void clearFont(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type)
212 	{
213 		checkClassBinding!(typeof(this))();
214 		ptrcall!(void)(_classBinding.clearFont, _godot_object, name, type);
215 	}
216 	/**
217 	Returns all of the $(D Font)s as a $(D PoolStringArray) filled with each $(D Font)'s name, for use in $(D getFont), if Theme has `type`.
218 	*/
219 	PoolStringArray getFontList(StringArg0)(in StringArg0 type) const
220 	{
221 		checkClassBinding!(typeof(this))();
222 		return ptrcall!(PoolStringArray)(_classBinding.getFontList, _godot_object, type);
223 	}
224 	/**
225 	Sets Theme's $(D Color) to `color` at `name` in `type`.
226 	Does nothing if Theme does not have `type`.
227 	*/
228 	void setColor(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type, in Color color)
229 	{
230 		checkClassBinding!(typeof(this))();
231 		ptrcall!(void)(_classBinding.setColor, _godot_object, name, type, color);
232 	}
233 	/**
234 	Returns the $(D Color) at `name` if Theme has `type`.
235 	*/
236 	Color getColor(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
237 	{
238 		checkClassBinding!(typeof(this))();
239 		return ptrcall!(Color)(_classBinding.getColor, _godot_object, name, type);
240 	}
241 	/**
242 	Returns `true` if $(D Color) with `name` is in `type`.
243 	Returns `false` if Theme does not have `type`.
244 	*/
245 	bool hasColor(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
246 	{
247 		checkClassBinding!(typeof(this))();
248 		return ptrcall!(bool)(_classBinding.hasColor, _godot_object, name, type);
249 	}
250 	/**
251 	Clears theme $(D Color) at `name` if Theme has `type`.
252 	*/
253 	void clearColor(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type)
254 	{
255 		checkClassBinding!(typeof(this))();
256 		ptrcall!(void)(_classBinding.clearColor, _godot_object, name, type);
257 	}
258 	/**
259 	Returns all of the $(D Color)s as a $(D PoolStringArray) filled with each $(D Color)'s name, for use in $(D getColor), if Theme has `type`.
260 	*/
261 	PoolStringArray getColorList(StringArg0)(in StringArg0 type) const
262 	{
263 		checkClassBinding!(typeof(this))();
264 		return ptrcall!(PoolStringArray)(_classBinding.getColorList, _godot_object, type);
265 	}
266 	/**
267 	Sets Theme's constant to `constant` at `name` in `type`.
268 	Does nothing if Theme does not have `type`.
269 	*/
270 	void setConstant(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type, in long constant)
271 	{
272 		checkClassBinding!(typeof(this))();
273 		ptrcall!(void)(_classBinding.setConstant, _godot_object, name, type, constant);
274 	}
275 	/**
276 	Returns the constant at `name` if Theme has `type`.
277 	*/
278 	long getConstant(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
279 	{
280 		checkClassBinding!(typeof(this))();
281 		return ptrcall!(long)(_classBinding.getConstant, _godot_object, name, type);
282 	}
283 	/**
284 	Returns `true` if constant with `name` is in `type`.
285 	Returns `false` if Theme does not have `type`.
286 	*/
287 	bool hasConstant(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type) const
288 	{
289 		checkClassBinding!(typeof(this))();
290 		return ptrcall!(bool)(_classBinding.hasConstant, _godot_object, name, type);
291 	}
292 	/**
293 	Clears theme constant at `name` if Theme has `type`.
294 	*/
295 	void clearConstant(StringArg0, StringArg1)(in StringArg0 name, in StringArg1 type)
296 	{
297 		checkClassBinding!(typeof(this))();
298 		ptrcall!(void)(_classBinding.clearConstant, _godot_object, name, type);
299 	}
300 	/**
301 	Returns all of the constants as a $(D PoolStringArray) filled with each constant's name, for use in $(D getConstant), if Theme has `type`.
302 	*/
303 	PoolStringArray getConstantList(StringArg0)(in StringArg0 type) const
304 	{
305 		checkClassBinding!(typeof(this))();
306 		return ptrcall!(PoolStringArray)(_classBinding.getConstantList, _godot_object, type);
307 	}
308 	/**
309 	
310 	*/
311 	void setDefaultFont(Font font)
312 	{
313 		checkClassBinding!(typeof(this))();
314 		ptrcall!(void)(_classBinding.setDefaultFont, _godot_object, font);
315 	}
316 	/**
317 	
318 	*/
319 	Ref!Font getDefaultFont() const
320 	{
321 		checkClassBinding!(typeof(this))();
322 		return ptrcall!(Font)(_classBinding.getDefaultFont, _godot_object);
323 	}
324 	/**
325 	Returns all of the types in `type` as a $(D PoolStringArray) for use in any of the get_* functions, if Theme has `type`.
326 	*/
327 	PoolStringArray getTypeList(StringArg0)(in StringArg0 type) const
328 	{
329 		checkClassBinding!(typeof(this))();
330 		return ptrcall!(PoolStringArray)(_classBinding.getTypeList, _godot_object, type);
331 	}
332 	/**
333 	
334 	*/
335 	void _emitThemeChanged()
336 	{
337 		Array _GODOT_args = Array.empty_array;
338 		String _GODOT_method_name = String("_emit_theme_changed");
339 		this.callv(_GODOT_method_name, _GODOT_args);
340 	}
341 	/**
342 	Sets theme values to a copy of the default theme values.
343 	*/
344 	void copyDefaultTheme()
345 	{
346 		checkClassBinding!(typeof(this))();
347 		ptrcall!(void)(_classBinding.copyDefaultTheme, _godot_object);
348 	}
349 	/**
350 	The theme's default font.
351 	*/
352 	@property Font defaultFont()
353 	{
354 		return getDefaultFont();
355 	}
356 	/// ditto
357 	@property void defaultFont(Font v)
358 	{
359 		setDefaultFont(v);
360 	}
361 }