1 /** 2 Dialog for confirmation of actions. 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.confirmationdialog; 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.acceptdialog; 25 import godot.windowdialog; 26 import godot.button; 27 /** 28 Dialog for confirmation of actions. 29 30 This dialog inherits from $(D AcceptDialog), but has by default an OK and Cancel button (in host OS order). 31 To get cancel action, you can use: 32 33 34 get_cancel().connect("pressed", self, "cancelled") 35 36 . 37 */ 38 @GodotBaseClass struct ConfirmationDialog 39 { 40 package(godot) enum string _GODOT_internal_name = "ConfirmationDialog"; 41 public: 42 @nogc nothrow: 43 union { /** */ godot_object _godot_object; /** */ AcceptDialog _GODOT_base; } 44 alias _GODOT_base this; 45 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 46 package(godot) __gshared bool _classBindingInitialized = false; 47 package(godot) static struct GDNativeClassBinding 48 { 49 __gshared: 50 @GodotName("get_cancel") GodotMethod!(Button) getCancel; 51 } 52 /// 53 pragma(inline, true) bool opEquals(in ConfirmationDialog other) const 54 { return _godot_object.ptr is other._godot_object.ptr; } 55 /// 56 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 57 { _godot_object.ptr = n; return null; } 58 /// 59 pragma(inline, true) bool opEquals(typeof(null) n) const 60 { return _godot_object.ptr is n; } 61 /// 62 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 63 mixin baseCasts; 64 /// Construct a new instance of ConfirmationDialog. 65 /// Note: use `memnew!ConfirmationDialog` instead. 66 static ConfirmationDialog _new() 67 { 68 static godot_class_constructor constructor; 69 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("ConfirmationDialog"); 70 if(constructor is null) return typeof(this).init; 71 return cast(ConfirmationDialog)(constructor()); 72 } 73 @disable new(size_t s); 74 /** 75 Returns the cancel button. 76 */ 77 Button getCancel() 78 { 79 checkClassBinding!(typeof(this))(); 80 return ptrcall!(Button)(GDNativeClassBinding.getCancel, _godot_object); 81 } 82 }