1 /** 2 Base class for window dialogs. 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.windowdialog; 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.popup; 25 import godot.control; 26 import godot.canvasitem; 27 import godot.node; 28 import godot.inputevent; 29 import godot.texturebutton; 30 /** 31 Base class for window dialogs. 32 33 Windowdialog is the base class for all window-based dialogs. It's a by-default toplevel $(D Control) that draws a window decoration and allows motion and resizing. 34 */ 35 @GodotBaseClass struct WindowDialog 36 { 37 package(godot) enum string _GODOT_internal_name = "WindowDialog"; 38 public: 39 @nogc nothrow: 40 union { /** */ godot_object _godot_object; /** */ Popup _GODOT_base; } 41 alias _GODOT_base this; 42 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 43 package(godot) __gshared bool _classBindingInitialized = false; 44 package(godot) static struct GDNativeClassBinding 45 { 46 __gshared: 47 @GodotName("_closed") GodotMethod!(void) _closed; 48 @GodotName("_gui_input") GodotMethod!(void, InputEvent) _guiInput; 49 @GodotName("get_close_button") GodotMethod!(TextureButton) getCloseButton; 50 @GodotName("get_resizable") GodotMethod!(bool) getResizable; 51 @GodotName("get_title") GodotMethod!(String) getTitle; 52 @GodotName("set_resizable") GodotMethod!(void, bool) setResizable; 53 @GodotName("set_title") GodotMethod!(void, String) setTitle; 54 } 55 /// 56 pragma(inline, true) bool opEquals(in WindowDialog other) const 57 { return _godot_object.ptr is other._godot_object.ptr; } 58 /// 59 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 60 { _godot_object.ptr = n; return null; } 61 /// 62 pragma(inline, true) bool opEquals(typeof(null) n) const 63 { return _godot_object.ptr is n; } 64 /// 65 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 66 mixin baseCasts; 67 /// Construct a new instance of WindowDialog. 68 /// Note: use `memnew!WindowDialog` instead. 69 static WindowDialog _new() 70 { 71 static godot_class_constructor constructor; 72 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("WindowDialog"); 73 if(constructor is null) return typeof(this).init; 74 return cast(WindowDialog)(constructor()); 75 } 76 @disable new(size_t s); 77 /** 78 79 */ 80 void _closed() 81 { 82 Array _GODOT_args = Array.make(); 83 String _GODOT_method_name = String("_closed"); 84 this.callv(_GODOT_method_name, _GODOT_args); 85 } 86 /** 87 88 */ 89 void _guiInput(InputEvent arg0) 90 { 91 Array _GODOT_args = Array.make(); 92 _GODOT_args.append(arg0); 93 String _GODOT_method_name = String("_gui_input"); 94 this.callv(_GODOT_method_name, _GODOT_args); 95 } 96 /** 97 Returns the close $(D TextureButton). 98 */ 99 TextureButton getCloseButton() 100 { 101 checkClassBinding!(typeof(this))(); 102 return ptrcall!(TextureButton)(GDNativeClassBinding.getCloseButton, _godot_object); 103 } 104 /** 105 106 */ 107 bool getResizable() const 108 { 109 checkClassBinding!(typeof(this))(); 110 return ptrcall!(bool)(GDNativeClassBinding.getResizable, _godot_object); 111 } 112 /** 113 114 */ 115 String getTitle() const 116 { 117 checkClassBinding!(typeof(this))(); 118 return ptrcall!(String)(GDNativeClassBinding.getTitle, _godot_object); 119 } 120 /** 121 122 */ 123 void setResizable(in bool resizable) 124 { 125 checkClassBinding!(typeof(this))(); 126 ptrcall!(void)(GDNativeClassBinding.setResizable, _godot_object, resizable); 127 } 128 /** 129 130 */ 131 void setTitle(in String title) 132 { 133 checkClassBinding!(typeof(this))(); 134 ptrcall!(void)(GDNativeClassBinding.setTitle, _godot_object, title); 135 } 136 /** 137 If `true`, the user can resize the window. 138 */ 139 @property bool resizable() 140 { 141 return getResizable(); 142 } 143 /// ditto 144 @property void resizable(bool v) 145 { 146 setResizable(v); 147 } 148 /** 149 The text displayed in the window's title bar. 150 */ 151 @property String windowTitle() 152 { 153 return getTitle(); 154 } 155 /// ditto 156 @property void windowTitle(String v) 157 { 158 setTitle(v); 159 } 160 }