1 /**
2 Customizable Stylebox with a given set of parameters. (no texture required)
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.styleboxflat;
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.stylebox;
24 import godot.resource;
25 import godot.reference;
26 /**
27 Customizable Stylebox with a given set of parameters. (no texture required)
28 
29 This stylebox can be used to achieve all kinds of looks without the need of a texture. Those properties are customizable:
30  - Color
31  - Border width (individual width for each border)
32  - Rounded corners (individual radius for each corner)
33  - Shadow
34  About corner radius:
35  	Setting corner radius to high values is allowed. As soon as corners would overlap the stylebox will switch to a relative system. Example:
36 	
37 
38 	height = 30
39 	corner_radius_top_left = 50
40 	corner_radius_bottom_left = 100
41 	
42 
43 	The relative system now would take the 1:2 ratio of the two left corners to calculate the actual corner width. Both corners added will $(B never) be more than the height. Result:
44 	
45 
46 	corner_radius_top_left: 10
47 	corner_radius_bottom_left: 20
48 	
49 
50 */
51 @GodotBaseClass struct StyleBoxFlat
52 {
53 	enum string _GODOT_internal_name = "StyleBoxFlat";
54 public:
55 @nogc nothrow:
56 	union { godot_object _godot_object; StyleBox _GODOT_base; }
57 	alias _GODOT_base this;
58 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
59 	package(godot) __gshared bool _classBindingInitialized = false;
60 	package(godot) static struct _classBinding
61 	{
62 		__gshared:
63 		@GodotName("set_bg_color") GodotMethod!(void, Color) setBgColor;
64 		@GodotName("get_bg_color") GodotMethod!(Color) getBgColor;
65 		@GodotName("set_border_color") GodotMethod!(void, Color) setBorderColor;
66 		@GodotName("get_border_color") GodotMethod!(Color) getBorderColor;
67 		@GodotName("set_border_width_all") GodotMethod!(void, long) setBorderWidthAll;
68 		@GodotName("get_border_width_min") GodotMethod!(long) getBorderWidthMin;
69 		@GodotName("set_border_width") GodotMethod!(void, long, long) setBorderWidth;
70 		@GodotName("get_border_width") GodotMethod!(long, long) getBorderWidth;
71 		@GodotName("set_border_blend") GodotMethod!(void, bool) setBorderBlend;
72 		@GodotName("get_border_blend") GodotMethod!(bool) getBorderBlend;
73 		@GodotName("set_corner_radius_individual") GodotMethod!(void, long, long, long, long) setCornerRadiusIndividual;
74 		@GodotName("set_corner_radius_all") GodotMethod!(void, long) setCornerRadiusAll;
75 		@GodotName("set_corner_radius") GodotMethod!(void, long, long) setCornerRadius;
76 		@GodotName("get_corner_radius") GodotMethod!(long, long) getCornerRadius;
77 		@GodotName("set_expand_margin") GodotMethod!(void, long, double) setExpandMargin;
78 		@GodotName("set_expand_margin_all") GodotMethod!(void, double) setExpandMarginAll;
79 		@GodotName("set_expand_margin_individual") GodotMethod!(void, double, double, double, double) setExpandMarginIndividual;
80 		@GodotName("get_expand_margin") GodotMethod!(double, long) getExpandMargin;
81 		@GodotName("set_draw_center") GodotMethod!(void, bool) setDrawCenter;
82 		@GodotName("is_draw_center_enabled") GodotMethod!(bool) isDrawCenterEnabled;
83 		@GodotName("set_shadow_color") GodotMethod!(void, Color) setShadowColor;
84 		@GodotName("get_shadow_color") GodotMethod!(Color) getShadowColor;
85 		@GodotName("set_shadow_size") GodotMethod!(void, long) setShadowSize;
86 		@GodotName("get_shadow_size") GodotMethod!(long) getShadowSize;
87 		@GodotName("set_anti_aliased") GodotMethod!(void, bool) setAntiAliased;
88 		@GodotName("is_anti_aliased") GodotMethod!(bool) isAntiAliased;
89 		@GodotName("set_aa_size") GodotMethod!(void, long) setAaSize;
90 		@GodotName("get_aa_size") GodotMethod!(long) getAaSize;
91 		@GodotName("set_corner_detail") GodotMethod!(void, long) setCornerDetail;
92 		@GodotName("get_corner_detail") GodotMethod!(long) getCornerDetail;
93 	}
94 	bool opEquals(in StyleBoxFlat other) const { return _godot_object.ptr is other._godot_object.ptr; }
95 	StyleBoxFlat opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
96 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
97 	mixin baseCasts;
98 	static StyleBoxFlat _new()
99 	{
100 		static godot_class_constructor constructor;
101 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("StyleBoxFlat");
102 		if(constructor is null) return typeof(this).init;
103 		return cast(StyleBoxFlat)(constructor());
104 	}
105 	@disable new(size_t s);
106 	/**
107 	
108 	*/
109 	void setBgColor(in Color color)
110 	{
111 		checkClassBinding!(typeof(this))();
112 		ptrcall!(void)(_classBinding.setBgColor, _godot_object, color);
113 	}
114 	/**
115 	
116 	*/
117 	Color getBgColor() const
118 	{
119 		checkClassBinding!(typeof(this))();
120 		return ptrcall!(Color)(_classBinding.getBgColor, _godot_object);
121 	}
122 	/**
123 	
124 	*/
125 	void setBorderColor(in Color color)
126 	{
127 		checkClassBinding!(typeof(this))();
128 		ptrcall!(void)(_classBinding.setBorderColor, _godot_object, color);
129 	}
130 	/**
131 	
132 	*/
133 	Color getBorderColor() const
134 	{
135 		checkClassBinding!(typeof(this))();
136 		return ptrcall!(Color)(_classBinding.getBorderColor, _godot_object);
137 	}
138 	/**
139 	
140 	*/
141 	void setBorderWidthAll(in long width)
142 	{
143 		checkClassBinding!(typeof(this))();
144 		ptrcall!(void)(_classBinding.setBorderWidthAll, _godot_object, width);
145 	}
146 	/**
147 	
148 	*/
149 	long getBorderWidthMin() const
150 	{
151 		checkClassBinding!(typeof(this))();
152 		return ptrcall!(long)(_classBinding.getBorderWidthMin, _godot_object);
153 	}
154 	/**
155 	
156 	*/
157 	void setBorderWidth(in long margin, in long width)
158 	{
159 		checkClassBinding!(typeof(this))();
160 		ptrcall!(void)(_classBinding.setBorderWidth, _godot_object, margin, width);
161 	}
162 	/**
163 	
164 	*/
165 	long getBorderWidth(in long margin) const
166 	{
167 		checkClassBinding!(typeof(this))();
168 		return ptrcall!(long)(_classBinding.getBorderWidth, _godot_object, margin);
169 	}
170 	/**
171 	
172 	*/
173 	void setBorderBlend(in bool blend)
174 	{
175 		checkClassBinding!(typeof(this))();
176 		ptrcall!(void)(_classBinding.setBorderBlend, _godot_object, blend);
177 	}
178 	/**
179 	
180 	*/
181 	bool getBorderBlend() const
182 	{
183 		checkClassBinding!(typeof(this))();
184 		return ptrcall!(bool)(_classBinding.getBorderBlend, _godot_object);
185 	}
186 	/**
187 	
188 	*/
189 	void setCornerRadiusIndividual(in long radius_top_left, in long radius_top_right, in long radius_bottom_right, in long radius_bottom_left)
190 	{
191 		checkClassBinding!(typeof(this))();
192 		ptrcall!(void)(_classBinding.setCornerRadiusIndividual, _godot_object, radius_top_left, radius_top_right, radius_bottom_right, radius_bottom_left);
193 	}
194 	/**
195 	
196 	*/
197 	void setCornerRadiusAll(in long radius)
198 	{
199 		checkClassBinding!(typeof(this))();
200 		ptrcall!(void)(_classBinding.setCornerRadiusAll, _godot_object, radius);
201 	}
202 	/**
203 	
204 	*/
205 	void setCornerRadius(in long corner, in long radius)
206 	{
207 		checkClassBinding!(typeof(this))();
208 		ptrcall!(void)(_classBinding.setCornerRadius, _godot_object, corner, radius);
209 	}
210 	/**
211 	
212 	*/
213 	long getCornerRadius(in long corner) const
214 	{
215 		checkClassBinding!(typeof(this))();
216 		return ptrcall!(long)(_classBinding.getCornerRadius, _godot_object, corner);
217 	}
218 	/**
219 	
220 	*/
221 	void setExpandMargin(in long margin, in double size)
222 	{
223 		checkClassBinding!(typeof(this))();
224 		ptrcall!(void)(_classBinding.setExpandMargin, _godot_object, margin, size);
225 	}
226 	/**
227 	
228 	*/
229 	void setExpandMarginAll(in double size)
230 	{
231 		checkClassBinding!(typeof(this))();
232 		ptrcall!(void)(_classBinding.setExpandMarginAll, _godot_object, size);
233 	}
234 	/**
235 	
236 	*/
237 	void setExpandMarginIndividual(in double size_left, in double size_top, in double size_right, in double size_bottom)
238 	{
239 		checkClassBinding!(typeof(this))();
240 		ptrcall!(void)(_classBinding.setExpandMarginIndividual, _godot_object, size_left, size_top, size_right, size_bottom);
241 	}
242 	/**
243 	
244 	*/
245 	double getExpandMargin(in long margin) const
246 	{
247 		checkClassBinding!(typeof(this))();
248 		return ptrcall!(double)(_classBinding.getExpandMargin, _godot_object, margin);
249 	}
250 	/**
251 	
252 	*/
253 	void setDrawCenter(in bool draw_center)
254 	{
255 		checkClassBinding!(typeof(this))();
256 		ptrcall!(void)(_classBinding.setDrawCenter, _godot_object, draw_center);
257 	}
258 	/**
259 	
260 	*/
261 	bool isDrawCenterEnabled() const
262 	{
263 		checkClassBinding!(typeof(this))();
264 		return ptrcall!(bool)(_classBinding.isDrawCenterEnabled, _godot_object);
265 	}
266 	/**
267 	
268 	*/
269 	void setShadowColor(in Color color)
270 	{
271 		checkClassBinding!(typeof(this))();
272 		ptrcall!(void)(_classBinding.setShadowColor, _godot_object, color);
273 	}
274 	/**
275 	
276 	*/
277 	Color getShadowColor() const
278 	{
279 		checkClassBinding!(typeof(this))();
280 		return ptrcall!(Color)(_classBinding.getShadowColor, _godot_object);
281 	}
282 	/**
283 	
284 	*/
285 	void setShadowSize(in long size)
286 	{
287 		checkClassBinding!(typeof(this))();
288 		ptrcall!(void)(_classBinding.setShadowSize, _godot_object, size);
289 	}
290 	/**
291 	
292 	*/
293 	long getShadowSize() const
294 	{
295 		checkClassBinding!(typeof(this))();
296 		return ptrcall!(long)(_classBinding.getShadowSize, _godot_object);
297 	}
298 	/**
299 	
300 	*/
301 	void setAntiAliased(in bool anti_aliased)
302 	{
303 		checkClassBinding!(typeof(this))();
304 		ptrcall!(void)(_classBinding.setAntiAliased, _godot_object, anti_aliased);
305 	}
306 	/**
307 	
308 	*/
309 	bool isAntiAliased() const
310 	{
311 		checkClassBinding!(typeof(this))();
312 		return ptrcall!(bool)(_classBinding.isAntiAliased, _godot_object);
313 	}
314 	/**
315 	
316 	*/
317 	void setAaSize(in long size)
318 	{
319 		checkClassBinding!(typeof(this))();
320 		ptrcall!(void)(_classBinding.setAaSize, _godot_object, size);
321 	}
322 	/**
323 	
324 	*/
325 	long getAaSize() const
326 	{
327 		checkClassBinding!(typeof(this))();
328 		return ptrcall!(long)(_classBinding.getAaSize, _godot_object);
329 	}
330 	/**
331 	
332 	*/
333 	void setCornerDetail(in long detail)
334 	{
335 		checkClassBinding!(typeof(this))();
336 		ptrcall!(void)(_classBinding.setCornerDetail, _godot_object, detail);
337 	}
338 	/**
339 	
340 	*/
341 	long getCornerDetail() const
342 	{
343 		checkClassBinding!(typeof(this))();
344 		return ptrcall!(long)(_classBinding.getCornerDetail, _godot_object);
345 	}
346 	/**
347 	The background color of the stylebox.
348 	*/
349 	@property Color bgColor()
350 	{
351 		return getBgColor();
352 	}
353 	/// ditto
354 	@property void bgColor(Color v)
355 	{
356 		setBgColor(v);
357 	}
358 	/**
359 	Toggels drawing of the inner part of the stylebox.
360 	*/
361 	@property bool drawCenter()
362 	{
363 		return isDrawCenterEnabled();
364 	}
365 	/// ditto
366 	@property void drawCenter(bool v)
367 	{
368 		setDrawCenter(v);
369 	}
370 	/**
371 	Border width for the left border.
372 	*/
373 	@property long borderWidthLeft()
374 	{
375 		return getBorderWidth(0);
376 	}
377 	/// ditto
378 	@property void borderWidthLeft(long v)
379 	{
380 		setBorderWidth(0, v);
381 	}
382 	/**
383 	Border width for the top border.
384 	*/
385 	@property long borderWidthTop()
386 	{
387 		return getBorderWidth(1);
388 	}
389 	/// ditto
390 	@property void borderWidthTop(long v)
391 	{
392 		setBorderWidth(1, v);
393 	}
394 	/**
395 	Border width for the right border.
396 	*/
397 	@property long borderWidthRight()
398 	{
399 		return getBorderWidth(2);
400 	}
401 	/// ditto
402 	@property void borderWidthRight(long v)
403 	{
404 		setBorderWidth(2, v);
405 	}
406 	/**
407 	Border width for the bottom border.
408 	*/
409 	@property long borderWidthBottom()
410 	{
411 		return getBorderWidth(3);
412 	}
413 	/// ditto
414 	@property void borderWidthBottom(long v)
415 	{
416 		setBorderWidth(3, v);
417 	}
418 	/**
419 	Sets the color of the border.
420 	*/
421 	@property Color borderColor()
422 	{
423 		return getBorderColor();
424 	}
425 	/// ditto
426 	@property void borderColor(Color v)
427 	{
428 		setBorderColor(v);
429 	}
430 	/**
431 	When set to true, the border will fade into the background color.
432 	*/
433 	@property bool borderBlend()
434 	{
435 		return getBorderBlend();
436 	}
437 	/// ditto
438 	@property void borderBlend(bool v)
439 	{
440 		setBorderBlend(v);
441 	}
442 	/**
443 	The corner radius of the top left corner. When set to 0 the corner is not rounded.
444 	*/
445 	@property long cornerRadiusTopLeft()
446 	{
447 		return getCornerRadius(0);
448 	}
449 	/// ditto
450 	@property void cornerRadiusTopLeft(long v)
451 	{
452 		setCornerRadius(0, v);
453 	}
454 	/**
455 	The corner radius of the top right corner. When set to 0 the corner is not rounded.
456 	*/
457 	@property long cornerRadiusTopRight()
458 	{
459 		return getCornerRadius(1);
460 	}
461 	/// ditto
462 	@property void cornerRadiusTopRight(long v)
463 	{
464 		setCornerRadius(1, v);
465 	}
466 	/**
467 	The corner radius of the bottom right corner. When set to 0 the corner is not rounded.
468 	*/
469 	@property long cornerRadiusBottomRight()
470 	{
471 		return getCornerRadius(2);
472 	}
473 	/// ditto
474 	@property void cornerRadiusBottomRight(long v)
475 	{
476 		setCornerRadius(2, v);
477 	}
478 	/**
479 	The corner radius of the bottom left corner. When set to 0 the corner is not rounded.
480 	*/
481 	@property long cornerRadiusBottomLeft()
482 	{
483 		return getCornerRadius(3);
484 	}
485 	/// ditto
486 	@property void cornerRadiusBottomLeft(long v)
487 	{
488 		setCornerRadius(3, v);
489 	}
490 	/**
491 	This sets the amount of vertices used for each corner. Higher values result in rounder corners but take more processing power to compute. When choosing a value you should take the corner radius ($(D setCornerRadius)) into account.
492 	For corner radius smaller than 10: 4-5 should be enough
493 	For corner radius smaller than 30: 8-12 should be enough ...
494 	*/
495 	@property long cornerDetail()
496 	{
497 		return getCornerDetail();
498 	}
499 	/// ditto
500 	@property void cornerDetail(long v)
501 	{
502 		setCornerDetail(v);
503 	}
504 	/**
505 	Expands the stylebox outside of the control rect on the left edge. Useful in combination with border_width_left. To draw a border outside the control rect.
506 	*/
507 	@property double expandMarginLeft()
508 	{
509 		return getExpandMargin(0);
510 	}
511 	/// ditto
512 	@property void expandMarginLeft(double v)
513 	{
514 		setExpandMargin(0, v);
515 	}
516 	/**
517 	Expands the stylebox outside of the control rect on the right edge. Useful in combination with border_width_right. To draw a border outside the control rect.
518 	*/
519 	@property double expandMarginRight()
520 	{
521 		return getExpandMargin(2);
522 	}
523 	/// ditto
524 	@property void expandMarginRight(double v)
525 	{
526 		setExpandMargin(2, v);
527 	}
528 	/**
529 	Expands the stylebox outside of the control rect on the top edge. Useful in combination with border_width_top. To draw a border outside the control rect.
530 	*/
531 	@property double expandMarginTop()
532 	{
533 		return getExpandMargin(1);
534 	}
535 	/// ditto
536 	@property void expandMarginTop(double v)
537 	{
538 		setExpandMargin(1, v);
539 	}
540 	/**
541 	Expands the stylebox outside of the control rect on the bottom edge. Useful in combination with border_width_bottom. To draw a border outside the control rect.
542 	*/
543 	@property double expandMarginBottom()
544 	{
545 		return getExpandMargin(3);
546 	}
547 	/// ditto
548 	@property void expandMarginBottom(double v)
549 	{
550 		setExpandMargin(3, v);
551 	}
552 	/**
553 	The color of the shadow. (This has no effect when shadow_size < 1)
554 	*/
555 	@property Color shadowColor()
556 	{
557 		return getShadowColor();
558 	}
559 	/// ditto
560 	@property void shadowColor(Color v)
561 	{
562 		setShadowColor(v);
563 	}
564 	/**
565 	The shadow size in pixels.
566 	*/
567 	@property long shadowSize()
568 	{
569 		return getShadowSize();
570 	}
571 	/// ditto
572 	@property void shadowSize(long v)
573 	{
574 		setShadowSize(v);
575 	}
576 	/**
577 	Anti Aliasing draws a small ring around edges. This ring fades to transparent. As a result edges look much smoother. This is only noticeable when using rounded corners.
578 	*/
579 	@property bool antiAliasing()
580 	{
581 		return isAntiAliased();
582 	}
583 	/// ditto
584 	@property void antiAliasing(bool v)
585 	{
586 		setAntiAliased(v);
587 	}
588 	/**
589 	This changes the size of the faded ring. Higher values can be used to achieve a "blurry" effect.
590 	*/
591 	@property long antiAliasingSize()
592 	{
593 		return getAaSize();
594 	}
595 	/// ditto
596 	@property void antiAliasingSize(long v)
597 	{
598 		setAaSize(v);
599 	}
600 }