1 /** 2 The Editor's popup dialog for creating new $(D Script) files. 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.scriptcreatedialog; 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.confirmationdialog; 24 import godot.acceptdialog; 25 import godot.windowdialog; 26 /** 27 The Editor's popup dialog for creating new $(D Script) files. 28 29 The $(D ScriptCreateDialog) creates script files according to a given template for a given scripting language. The standard use is to configure its fields prior to calling one of the $(D Popup.popup) methods. 30 31 32 func _ready(): 33 dialog.config("Node", "res://new_node.gd") # For in-engine types 34 dialog.config("\"res://base_node.gd\"", "res://derived_node.gd") # For script types 35 dialog.popup_centered() 36 37 38 */ 39 @GodotBaseClass struct ScriptCreateDialog 40 { 41 package(godot) enum string _GODOT_internal_name = "ScriptCreateDialog"; 42 public: 43 @nogc nothrow: 44 union { /** */ godot_object _godot_object; /** */ ConfirmationDialog _GODOT_base; } 45 alias _GODOT_base this; 46 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 47 package(godot) __gshared bool _classBindingInitialized = false; 48 package(godot) static struct GDNativeClassBinding 49 { 50 __gshared: 51 @GodotName("_browse_class_in_tree") GodotMethod!(void) _browseClassInTree; 52 @GodotName("_browse_path") GodotMethod!(void, bool, bool) _browsePath; 53 @GodotName("_built_in_pressed") GodotMethod!(void) _builtInPressed; 54 @GodotName("_class_name_changed") GodotMethod!(void, String) _classNameChanged; 55 @GodotName("_create") GodotMethod!(void) _create; 56 @GodotName("_file_selected") GodotMethod!(void, String) _fileSelected; 57 @GodotName("_lang_changed") GodotMethod!(void, long) _langChanged; 58 @GodotName("_parent_name_changed") GodotMethod!(void, String) _parentNameChanged; 59 @GodotName("_path_changed") GodotMethod!(void, String) _pathChanged; 60 @GodotName("_path_entered") GodotMethod!(void, String) _pathEntered; 61 @GodotName("_path_hbox_sorted") GodotMethod!(void) _pathHboxSorted; 62 @GodotName("_template_changed") GodotMethod!(void, long) _templateChanged; 63 @GodotName("config") GodotMethod!(void, String, String, bool, bool) config; 64 } 65 /// 66 pragma(inline, true) bool opEquals(in ScriptCreateDialog other) const 67 { return _godot_object.ptr is other._godot_object.ptr; } 68 /// 69 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 70 { _godot_object.ptr = n; return null; } 71 /// 72 pragma(inline, true) bool opEquals(typeof(null) n) const 73 { return _godot_object.ptr is n; } 74 /// 75 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 76 mixin baseCasts; 77 /// Construct a new instance of ScriptCreateDialog. 78 /// Note: use `memnew!ScriptCreateDialog` instead. 79 static ScriptCreateDialog _new() 80 { 81 static godot_class_constructor constructor; 82 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ScriptCreateDialog"); 83 if(constructor is null) return typeof(this).init; 84 return cast(ScriptCreateDialog)(constructor()); 85 } 86 @disable new(size_t s); 87 /** 88 89 */ 90 void _browseClassInTree() 91 { 92 Array _GODOT_args = Array.make(); 93 String _GODOT_method_name = String("_browse_class_in_tree"); 94 this.callv(_GODOT_method_name, _GODOT_args); 95 } 96 /** 97 98 */ 99 void _browsePath(in bool arg0, in bool arg1) 100 { 101 Array _GODOT_args = Array.make(); 102 _GODOT_args.append(arg0); 103 _GODOT_args.append(arg1); 104 String _GODOT_method_name = String("_browse_path"); 105 this.callv(_GODOT_method_name, _GODOT_args); 106 } 107 /** 108 109 */ 110 void _builtInPressed() 111 { 112 Array _GODOT_args = Array.make(); 113 String _GODOT_method_name = String("_built_in_pressed"); 114 this.callv(_GODOT_method_name, _GODOT_args); 115 } 116 /** 117 118 */ 119 void _classNameChanged(in String arg0) 120 { 121 Array _GODOT_args = Array.make(); 122 _GODOT_args.append(arg0); 123 String _GODOT_method_name = String("_class_name_changed"); 124 this.callv(_GODOT_method_name, _GODOT_args); 125 } 126 /** 127 128 */ 129 void _create() 130 { 131 Array _GODOT_args = Array.make(); 132 String _GODOT_method_name = String("_create"); 133 this.callv(_GODOT_method_name, _GODOT_args); 134 } 135 /** 136 137 */ 138 void _fileSelected(in String arg0) 139 { 140 Array _GODOT_args = Array.make(); 141 _GODOT_args.append(arg0); 142 String _GODOT_method_name = String("_file_selected"); 143 this.callv(_GODOT_method_name, _GODOT_args); 144 } 145 /** 146 147 */ 148 void _langChanged(in long arg0) 149 { 150 Array _GODOT_args = Array.make(); 151 _GODOT_args.append(arg0); 152 String _GODOT_method_name = String("_lang_changed"); 153 this.callv(_GODOT_method_name, _GODOT_args); 154 } 155 /** 156 157 */ 158 void _parentNameChanged(in String arg0) 159 { 160 Array _GODOT_args = Array.make(); 161 _GODOT_args.append(arg0); 162 String _GODOT_method_name = String("_parent_name_changed"); 163 this.callv(_GODOT_method_name, _GODOT_args); 164 } 165 /** 166 167 */ 168 void _pathChanged(in String arg0) 169 { 170 Array _GODOT_args = Array.make(); 171 _GODOT_args.append(arg0); 172 String _GODOT_method_name = String("_path_changed"); 173 this.callv(_GODOT_method_name, _GODOT_args); 174 } 175 /** 176 177 */ 178 void _pathEntered(in String arg0) 179 { 180 Array _GODOT_args = Array.make(); 181 _GODOT_args.append(arg0); 182 String _GODOT_method_name = String("_path_entered"); 183 this.callv(_GODOT_method_name, _GODOT_args); 184 } 185 /** 186 187 */ 188 void _pathHboxSorted() 189 { 190 Array _GODOT_args = Array.make(); 191 String _GODOT_method_name = String("_path_hbox_sorted"); 192 this.callv(_GODOT_method_name, _GODOT_args); 193 } 194 /** 195 196 */ 197 void _templateChanged(in long arg0) 198 { 199 Array _GODOT_args = Array.make(); 200 _GODOT_args.append(arg0); 201 String _GODOT_method_name = String("_template_changed"); 202 this.callv(_GODOT_method_name, _GODOT_args); 203 } 204 /** 205 Prefills required fields to configure the ScriptCreateDialog for use. 206 */ 207 void config(in String inherits, in String path, in bool built_in_enabled = true, in bool load_enabled = true) 208 { 209 checkClassBinding!(typeof(this))(); 210 ptrcall!(void)(GDNativeClassBinding.config, _godot_object, inherits, path, built_in_enabled, load_enabled); 211 } 212 }