1 /** 2 Control for holding $(D Viewport)s. 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.viewportcontainer; 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.container; 24 import godot.inputevent; 25 import godot.control; 26 import godot.canvasitem; 27 import godot.node; 28 /** 29 Control for holding $(D Viewport)s. 30 31 A $(D Container) node that holds a $(D Viewport), automatically setting its size. 32 */ 33 @GodotBaseClass struct ViewportContainer 34 { 35 enum string _GODOT_internal_name = "ViewportContainer"; 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 _classBinding 43 { 44 __gshared: 45 @GodotName("_input") GodotMethod!(void, InputEvent) _input; 46 @GodotName("set_stretch") GodotMethod!(void, bool) setStretch; 47 @GodotName("is_stretch_enabled") GodotMethod!(bool) isStretchEnabled; 48 @GodotName("set_stretch_shrink") GodotMethod!(void, long) setStretchShrink; 49 @GodotName("get_stretch_shrink") GodotMethod!(long) getStretchShrink; 50 } 51 bool opEquals(in ViewportContainer other) const { return _godot_object.ptr is other._godot_object.ptr; } 52 ViewportContainer opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 53 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 54 mixin baseCasts; 55 static ViewportContainer _new() 56 { 57 static godot_class_constructor constructor; 58 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ViewportContainer"); 59 if(constructor is null) return typeof(this).init; 60 return cast(ViewportContainer)(constructor()); 61 } 62 @disable new(size_t s); 63 /** 64 65 */ 66 void _input(InputEvent event) 67 { 68 Array _GODOT_args = Array.empty_array; 69 _GODOT_args.append(event); 70 String _GODOT_method_name = String("_input"); 71 this.callv(_GODOT_method_name, _GODOT_args); 72 } 73 /** 74 75 */ 76 void setStretch(in bool enable) 77 { 78 checkClassBinding!(typeof(this))(); 79 ptrcall!(void)(_classBinding.setStretch, _godot_object, enable); 80 } 81 /** 82 83 */ 84 bool isStretchEnabled() const 85 { 86 checkClassBinding!(typeof(this))(); 87 return ptrcall!(bool)(_classBinding.isStretchEnabled, _godot_object); 88 } 89 /** 90 91 */ 92 void setStretchShrink(in long amount) 93 { 94 checkClassBinding!(typeof(this))(); 95 ptrcall!(void)(_classBinding.setStretchShrink, _godot_object, amount); 96 } 97 /** 98 99 */ 100 long getStretchShrink() const 101 { 102 checkClassBinding!(typeof(this))(); 103 return ptrcall!(long)(_classBinding.getStretchShrink, _godot_object); 104 } 105 /** 106 If `true` the viewport will be scaled to the control's size. Default value:`false`. 107 */ 108 @property bool stretch() 109 { 110 return isStretchEnabled(); 111 } 112 /// ditto 113 @property void stretch(bool v) 114 { 115 setStretch(v); 116 } 117 /** 118 119 */ 120 @property long stretchShrink() 121 { 122 return getStretchShrink(); 123 } 124 /// ditto 125 @property void stretchShrink(long v) 126 { 127 setStretchShrink(v); 128 } 129 }