1 /** 2 Reference frame for GUI. 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.referencerect; 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.control; 25 import godot.canvasitem; 26 import godot.node; 27 /** 28 Reference frame for GUI. 29 30 A rectangle box that displays only a $(D borderColor) border color around its rectangle. $(D ReferenceRect) has no fill $(D Color). If you need to display a rectangle filled with a solid color, consider using $(D ColorRect) instead. 31 */ 32 @GodotBaseClass struct ReferenceRect 33 { 34 package(godot) enum string _GODOT_internal_name = "ReferenceRect"; 35 public: 36 @nogc nothrow: 37 union { /** */ godot_object _godot_object; /** */ Control _GODOT_base; } 38 alias _GODOT_base this; 39 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 40 package(godot) __gshared bool _classBindingInitialized = false; 41 package(godot) static struct GDNativeClassBinding 42 { 43 __gshared: 44 @GodotName("get_border_color") GodotMethod!(Color) getBorderColor; 45 @GodotName("get_border_width") GodotMethod!(double) getBorderWidth; 46 @GodotName("get_editor_only") GodotMethod!(bool) getEditorOnly; 47 @GodotName("set_border_color") GodotMethod!(void, Color) setBorderColor; 48 @GodotName("set_border_width") GodotMethod!(void, double) setBorderWidth; 49 @GodotName("set_editor_only") GodotMethod!(void, bool) setEditorOnly; 50 } 51 /// 52 pragma(inline, true) bool opEquals(in ReferenceRect other) const 53 { return _godot_object.ptr is other._godot_object.ptr; } 54 /// 55 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 56 { _godot_object.ptr = n; return null; } 57 /// 58 pragma(inline, true) bool opEquals(typeof(null) n) const 59 { return _godot_object.ptr is n; } 60 /// 61 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 62 mixin baseCasts; 63 /// Construct a new instance of ReferenceRect. 64 /// Note: use `memnew!ReferenceRect` instead. 65 static ReferenceRect _new() 66 { 67 static godot_class_constructor constructor; 68 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ReferenceRect"); 69 if(constructor is null) return typeof(this).init; 70 return cast(ReferenceRect)(constructor()); 71 } 72 @disable new(size_t s); 73 /** 74 75 */ 76 Color getBorderColor() const 77 { 78 checkClassBinding!(typeof(this))(); 79 return ptrcall!(Color)(GDNativeClassBinding.getBorderColor, _godot_object); 80 } 81 /** 82 83 */ 84 double getBorderWidth() const 85 { 86 checkClassBinding!(typeof(this))(); 87 return ptrcall!(double)(GDNativeClassBinding.getBorderWidth, _godot_object); 88 } 89 /** 90 91 */ 92 bool getEditorOnly() const 93 { 94 checkClassBinding!(typeof(this))(); 95 return ptrcall!(bool)(GDNativeClassBinding.getEditorOnly, _godot_object); 96 } 97 /** 98 99 */ 100 void setBorderColor(in Color color) 101 { 102 checkClassBinding!(typeof(this))(); 103 ptrcall!(void)(GDNativeClassBinding.setBorderColor, _godot_object, color); 104 } 105 /** 106 107 */ 108 void setBorderWidth(in double width) 109 { 110 checkClassBinding!(typeof(this))(); 111 ptrcall!(void)(GDNativeClassBinding.setBorderWidth, _godot_object, width); 112 } 113 /** 114 115 */ 116 void setEditorOnly(in bool enabled) 117 { 118 checkClassBinding!(typeof(this))(); 119 ptrcall!(void)(GDNativeClassBinding.setEditorOnly, _godot_object, enabled); 120 } 121 /** 122 Sets the border $(D Color) of the $(D ReferenceRect). 123 */ 124 @property Color borderColor() 125 { 126 return getBorderColor(); 127 } 128 /// ditto 129 @property void borderColor(Color v) 130 { 131 setBorderColor(v); 132 } 133 /** 134 Sets the border width of the $(D ReferenceRect). The border grows both inwards and outwards with respect to the rectangle box. 135 */ 136 @property double borderWidth() 137 { 138 return getBorderWidth(); 139 } 140 /// ditto 141 @property void borderWidth(double v) 142 { 143 setBorderWidth(v); 144 } 145 /** 146 If set to `true`, the $(D ReferenceRect) will only be visible while in editor. Otherwise, $(D ReferenceRect) will be visible in game. 147 */ 148 @property bool editorOnly() 149 { 150 return getEditorOnly(); 151 } 152 /// ditto 153 @property void editorOnly(bool v) 154 { 155 setEditorOnly(v); 156 } 157 }