1 /** 2 Simple margin container. 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.margincontainer; 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.classdb; 24 import godot.container; 25 import godot.control; 26 import godot.canvasitem; 27 import godot.node; 28 /** 29 Simple margin container. 30 31 Adds a top, left, bottom, and right margin to all $(D Control) nodes that are direct children of the container. To control the $(D MarginContainer)'s margin, use the `margin_*` theme properties listed below. 32 $(B Note:) Be careful, $(D Control) margin values are different than the constant margin values. If you want to change the custom margin values of the $(D MarginContainer) by code, you should use the following examples: 33 34 35 # This code sample assumes the current script is extending MarginContainer. 36 var margin_value = 100 37 add_constant_override("margin_top", margin_value) 38 add_constant_override("margin_left", margin_value) 39 add_constant_override("margin_bottom", margin_value) 40 add_constant_override("margin_right", margin_value) 41 42 43 */ 44 @GodotBaseClass struct MarginContainer 45 { 46 package(godot) enum string _GODOT_internal_name = "MarginContainer"; 47 public: 48 @nogc nothrow: 49 union { /** */ godot_object _godot_object; /** */ Container _GODOT_base; } 50 alias _GODOT_base this; 51 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 52 package(godot) __gshared bool _classBindingInitialized = false; 53 package(godot) static struct GDNativeClassBinding 54 { 55 __gshared: 56 } 57 /// 58 pragma(inline, true) bool opEquals(in MarginContainer other) const 59 { return _godot_object.ptr is other._godot_object.ptr; } 60 /// 61 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 62 { _godot_object.ptr = n; return null; } 63 /// 64 pragma(inline, true) bool opEquals(typeof(null) n) const 65 { return _godot_object.ptr is n; } 66 /// 67 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 68 mixin baseCasts; 69 /// Construct a new instance of MarginContainer. 70 /// Note: use `memnew!MarginContainer` instead. 71 static MarginContainer _new() 72 { 73 static godot_class_constructor constructor; 74 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("MarginContainer"); 75 if(constructor is null) return typeof(this).init; 76 return cast(MarginContainer)(constructor()); 77 } 78 @disable new(size_t s); 79 }