AcceptDialog
A base dialog used for user notification.
AcceptDialog.swift:18class AcceptDialog
The default use of AcceptDialog
is to allow it to only be accepted or closed, with the same result. However, the [signal confirmed] and [signal canceled] signals allow to make the two actions different, and the addButton(text:right:action:)
method allows to add custom buttons and actions.
This object emits the following signals:
Superclasses
class Window
Base class for all windows, dialogs, and popups.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
class Signal1
Signal support.
Type members
Instance members
var canceled: SimpleSignal
Emitted when the dialog is closed or the button created with
addCancelButton(name:)
is pressed.var confirmed: SimpleSignal
Emitted when the dialog is accepted, i.e. the OK button is pressed.
var customAction: Signal1
Emitted when a custom button is pressed. See
addButton(text:right:action:)
.var dialogAutowrap: Bool
Sets autowrapping for the text in the dialog.
var dialogCloseOnEscape: Bool
If
true
, the dialog will be hidden when the escape key (escape
) is pressed.var dialogHideOnOk: Bool
If
true
, the dialog is hidden when the OK button is pressed. You can set it tofalse
if you want to do e.g. input validation when receiving the [signal confirmed] signal, and handle hiding the dialog in your own logic.var dialogText: String
The text displayed by the dialog.
var okButtonText: String
The text displayed by the OK button (see
getOkButton
).func addButton(text: String, right: Bool, action: String
) -> Button? Adds a button with label
text
and a customaction
to the dialog and returns the created button.action
will be passed to the [signal custom_action] signal when pressed.func addCancelButton(name: String
) -> Button? Adds a button with label
name
and a cancel action to the dialog and returns the created button.func getLabel(
) -> Label? Returns the label used for built-in text.
func getOkButton(
) -> Button? Returns the OK
Button
instance.func registerTextEnter(lineEdit: Control?
) Registers a
LineEdit
in the dialog. When the enter key is pressed, the dialog will be accepted.func removeButton(Control?
) Removes the
button
from the dialog. Does NOT free thebutton
. Thebutton
must be aButton
added withaddButton(text:right:action:)
oraddCancelButton(name:)
method. After removal, pressing thebutton
will no longer emit this dialog’s [signal custom_action] or [signal canceled] signals.
Subclasses
class ConfirmationDialog
A dialog used for confirmation of actions.