1 /**
2 Base dialog for user notification.
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.acceptdialog;
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.windowdialog;
24 import godot.button;
25 import godot.label;
26 import godot.popup;
27 import godot.control;
28 import godot.canvasitem;
29 import godot.node;
30 /**
31 Base dialog for user notification.
32 
33 This dialog is useful for small notifications to the user about an event. It can only be accepted or closed, with the same result.
34 */
35 @GodotBaseClass struct AcceptDialog
36 {
37 	enum string _GODOT_internal_name = "AcceptDialog";
38 public:
39 @nogc nothrow:
40 	union { godot_object _godot_object; WindowDialog _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 _classBinding
45 	{
46 		__gshared:
47 		@GodotName("_ok") GodotMethod!(void) _ok;
48 		@GodotName("get_ok") GodotMethod!(Button) getOk;
49 		@GodotName("get_label") GodotMethod!(Label) getLabel;
50 		@GodotName("set_hide_on_ok") GodotMethod!(void, bool) setHideOnOk;
51 		@GodotName("get_hide_on_ok") GodotMethod!(bool) getHideOnOk;
52 		@GodotName("add_button") GodotMethod!(Button, String, bool, String) addButton;
53 		@GodotName("add_cancel") GodotMethod!(Button, String) addCancel;
54 		@GodotName("_builtin_text_entered") GodotMethod!(void, String) _builtinTextEntered;
55 		@GodotName("register_text_enter") GodotMethod!(void, GodotObject) registerTextEnter;
56 		@GodotName("_custom_action") GodotMethod!(void, String) _customAction;
57 		@GodotName("set_text") GodotMethod!(void, String) setText;
58 		@GodotName("get_text") GodotMethod!(String) getText;
59 	}
60 	bool opEquals(in AcceptDialog other) const { return _godot_object.ptr is other._godot_object.ptr; }
61 	AcceptDialog opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; }
62 	bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; }
63 	mixin baseCasts;
64 	static AcceptDialog _new()
65 	{
66 		static godot_class_constructor constructor;
67 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("AcceptDialog");
68 		if(constructor is null) return typeof(this).init;
69 		return cast(AcceptDialog)(constructor());
70 	}
71 	@disable new(size_t s);
72 	/**
73 	
74 	*/
75 	void _ok()
76 	{
77 		Array _GODOT_args = Array.empty_array;
78 		String _GODOT_method_name = String("_ok");
79 		this.callv(_GODOT_method_name, _GODOT_args);
80 	}
81 	/**
82 	Return the OK Button.
83 	*/
84 	Button getOk()
85 	{
86 		checkClassBinding!(typeof(this))();
87 		return ptrcall!(Button)(_classBinding.getOk, _godot_object);
88 	}
89 	/**
90 	Return the label used for built-in text.
91 	*/
92 	Label getLabel()
93 	{
94 		checkClassBinding!(typeof(this))();
95 		return ptrcall!(Label)(_classBinding.getLabel, _godot_object);
96 	}
97 	/**
98 	
99 	*/
100 	void setHideOnOk(in bool enabled)
101 	{
102 		checkClassBinding!(typeof(this))();
103 		ptrcall!(void)(_classBinding.setHideOnOk, _godot_object, enabled);
104 	}
105 	/**
106 	
107 	*/
108 	bool getHideOnOk() const
109 	{
110 		checkClassBinding!(typeof(this))();
111 		return ptrcall!(bool)(_classBinding.getHideOnOk, _godot_object);
112 	}
113 	/**
114 	Adds a button with label $(I text) and a custom $(I action) to the dialog and returns the created button. $(I action) will be passed to the $(D customAction) signal when pressed.
115 	If `true`, $(I right) will place the button to the right of any sibling buttons. Default value: `false`.
116 	*/
117 	Button addButton(StringArg0, StringArg2)(in StringArg0 text, in bool right = false, in StringArg2 action = "")
118 	{
119 		checkClassBinding!(typeof(this))();
120 		return ptrcall!(Button)(_classBinding.addButton, _godot_object, text, right, action);
121 	}
122 	/**
123 	Adds a button with label $(I name) and a cancel action to the dialog and returns the created button.
124 	*/
125 	Button addCancel(StringArg0)(in StringArg0 name)
126 	{
127 		checkClassBinding!(typeof(this))();
128 		return ptrcall!(Button)(_classBinding.addCancel, _godot_object, name);
129 	}
130 	/**
131 	
132 	*/
133 	void _builtinTextEntered(StringArg0)(in StringArg0 arg0)
134 	{
135 		Array _GODOT_args = Array.empty_array;
136 		_GODOT_args.append(arg0);
137 		String _GODOT_method_name = String("_builtin_text_entered");
138 		this.callv(_GODOT_method_name, _GODOT_args);
139 	}
140 	/**
141 	Registers a $(D LineEdit) in the dialog. When the enter key is pressed, the dialog will be accepted.
142 	*/
143 	void registerTextEnter(GodotObject line_edit)
144 	{
145 		checkClassBinding!(typeof(this))();
146 		ptrcall!(void)(_classBinding.registerTextEnter, _godot_object, line_edit);
147 	}
148 	/**
149 	
150 	*/
151 	void _customAction(StringArg0)(in StringArg0 arg0)
152 	{
153 		Array _GODOT_args = Array.empty_array;
154 		_GODOT_args.append(arg0);
155 		String _GODOT_method_name = String("_custom_action");
156 		this.callv(_GODOT_method_name, _GODOT_args);
157 	}
158 	/**
159 	
160 	*/
161 	void setText(StringArg0)(in StringArg0 text)
162 	{
163 		checkClassBinding!(typeof(this))();
164 		ptrcall!(void)(_classBinding.setText, _godot_object, text);
165 	}
166 	/**
167 	
168 	*/
169 	String getText() const
170 	{
171 		checkClassBinding!(typeof(this))();
172 		return ptrcall!(String)(_classBinding.getText, _godot_object);
173 	}
174 	/**
175 	The text displayed by this dialog.
176 	*/
177 	@property String dialogText()
178 	{
179 		return getText();
180 	}
181 	/// ditto
182 	@property void dialogText(String v)
183 	{
184 		setText(v);
185 	}
186 	/**
187 	If `true` the dialog is hidden when the OK button is pressed. You can set it to `false` if you want to do e.g. input validation when receiving the $(D confirmed) signal, and handle hiding the dialog in your own logic. Default value: `true`.
188 	Note: Some nodes derived from this class can have a different default value, and potentially their own built-in logic overriding this setting. For example $(D FileDialog) defaults to `false`, and has its own input validation code that is called when you press OK, which eventually hides the dialog if the input is valid. As such this property can't be used in $(D FileDialog) to disable hiding the dialog when pressing OK.
189 	*/
190 	@property bool dialogHideOnOk()
191 	{
192 		return getHideOnOk();
193 	}
194 	/// ditto
195 	@property void dialogHideOnOk(bool v)
196 	{
197 		setHideOnOk(v);
198 	}
199 }