Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
GrowDirection
Control.swift:257enum GrowDirection
Cases
case begin
The control will grow to the left or top to make up if its minimum size is changed to be greater than its current size on the respective axis.
case end
The control will grow to the right or bottom to make up if its minimum size is changed to be greater than its current size on the respective axis.
case both
The control will grow in both directions equally to make up if its minimum size is changed to be greater than its current size.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (148) members.
Types
enum Anchor
enum CursorShape
enum FocusMode
enum LayoutDirection
enum LayoutPreset
enum LayoutPresetMode
enum MouseFilter
class Signal1
Signal support.
struct SizeFlags
enum TextDirection
Type members
static let notificationFocusEnter: Int
Sent when the node grabs focus.
static let notificationFocusExit: Int
Sent when the node loses focus.
static let notificationLayoutDirectionChanged: Int
Sent when control layout direction is changed.
static let notificationMouseEnter: Int
Sent when the mouse cursor enters the control’s (or any child control’s) visible area, that is not occluded behind other Controls or Windows, provided its
mouseFilter
lets the event reach it and regardless if it’s currently focused or not.static let notificationMouseEnterSelf: Int
Sent when the mouse cursor enters the control’s visible area, that is not occluded behind other Controls or Windows, provided its
mouseFilter
lets the event reach it and regardless if it’s currently focused or not.static let notificationMouseExit: Int
Sent when the mouse cursor leaves the control’s (and all child control’s) visible area, that is not occluded behind other Controls or Windows, provided its
mouseFilter
lets the event reach it and regardless if it’s currently focused or not.static let notificationMouseExitSelf: Int
Sent when the mouse cursor leaves the control’s visible area, that is not occluded behind other Controls or Windows, provided its
mouseFilter
lets the event reach it and regardless if it’s currently focused or not.static let notificationResized: Int
Sent when the node changes size. Use
size
to get the new size.static let notificationScrollBegin: Int
Sent when this node is inside a
ScrollContainer
which has begun being scrolled when dragging the scrollable area with a touch event. This notification is not sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.static let notificationScrollEnd: Int
Sent when this node is inside a
ScrollContainer
which has stopped being scrolled when dragging the scrollable area with a touch event. This notification is not sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.static let notificationThemeChanged: Int
Sent when the node needs to refresh its theme items. This happens in one of the following cases:
class var godotClassName: StringName
Instance members
var autoTranslate: Bool
Toggles if any text should automatically change to its translated version depending on the current locale.
var clipContents: Bool
Enables whether rendering of
CanvasItem
based children should be clipped to this control’s rectangle. Iftrue
, parts of a child which would be visibly outside of this control’s rectangle will not be rendered and won’t receive input.var customMinimumSize: Vector2
The minimum size of the node’s bounding rectangle. If you set it to a value greater than (0, 0), the node’s bounding rectangle will always have at least this size, even if its content is smaller. If it’s set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes.
var focusEntered: SimpleSignal
Emitted when the node gains focus.
var focusExited: SimpleSignal
Emitted when the node loses focus.
var focusMode: Control.FocusMode
The focus access mode for the control (None, Click or All). Only one Control can be focused at the same time, and it will receive keyboard, gamepad, and mouse signals.
var focusNeighborBottom: NodePath
Tells Godot which node it should give focus to if the user presses the down arrow on the keyboard or down on a gamepad by default. You can change the key by editing the
ProjectSettings/input/uiDown
input action. The node must be aControl
. If this property is not set, Godot will give focus to the closestControl
to the bottom of this one.var focusNeighborLeft: NodePath
Tells Godot which node it should give focus to if the user presses the left arrow on the keyboard or left on a gamepad by default. You can change the key by editing the
ProjectSettings/input/uiLeft
input action. The node must be aControl
. If this property is not set, Godot will give focus to the closestControl
to the left of this one.var focusNeighborRight: NodePath
Tells Godot which node it should give focus to if the user presses the right arrow on the keyboard or right on a gamepad by default. You can change the key by editing the
ProjectSettings/input/uiRight
input action. The node must be aControl
. If this property is not set, Godot will give focus to the closestControl
to the right of this one.var focusNeighborTop: NodePath
Tells Godot which node it should give focus to if the user presses the top arrow on the keyboard or top on a gamepad by default. You can change the key by editing the
ProjectSettings/input/uiUp
input action. The node must be aControl
. If this property is not set, Godot will give focus to the closestControl
to the top of this one.var focusNext: NodePath
Tells Godot which node it should give focus to if the user presses [kbd]Tab[/kbd] on a keyboard by default. You can change the key by editing the
ProjectSettings/input/uiFocusNext
input action.var focusPrevious: NodePath
Tells Godot which node it should give focus to if the user presses [kbd]Shift + Tab[/kbd] on a keyboard by default. You can change the key by editing the
ProjectSettings/input/uiFocusPrev
input action.var growHorizontal: Control.GrowDirection
Controls the direction on the horizontal axis in which the control should grow if its horizontal minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.
var growVertical: Control.GrowDirection
Controls the direction on the vertical axis in which the control should grow if its vertical minimum size is changed to be greater than its current size, as the control always has to be at least the minimum size.
var guiInput: Signal1
Emitted when the node receives an
InputEvent
.var layoutDirection: Control.LayoutDirection
Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew).
var localizeNumeralSystem: Bool
If
true
, automatically converts code line numbers, list indices,SpinBox
andProgressBar
values from the Western Arabic (0..9) to the numeral systems used in current locale.var minimumSizeChanged: SimpleSignal
Emitted when the node’s minimum size changes.
var mouseDefaultCursorShape: Control.CursorShape
The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system’s mouse cursors.
var mouseEntered: SimpleSignal
Emitted when the mouse cursor enters the control’s (or any child control’s) visible area, that is not occluded behind other Controls or Windows, provided its
mouseFilter
lets the event reach it and regardless if it’s currently focused or not.var mouseExited: SimpleSignal
Emitted when the mouse cursor leaves the control’s (and all child control’s) visible area, that is not occluded behind other Controls or Windows, provided its
mouseFilter
lets the event reach it and regardless if it’s currently focused or not.var mouseFilter: Control.MouseFilter
Controls whether the control will be able to receive mouse button input events through
_guiInput(event:)
and how these events should be handled. Also controls whether the control can receive the [signal mouse_entered], and [signal mouse_exited] signals. See the constants to learn what each does.var mouseForcePassScrollEvents: Bool
When enabled, scroll wheel events processed by
_guiInput(event:)
will be passed to the parent control even ifmouseFilter
is set to .stop. As it defaults to true, this allows nested scrollable containers to work out of the box.var offsetBottom: Double
Distance between the node’s bottom edge and its parent control, based on
anchorBottom
.var offsetLeft: Double
Distance between the node’s left edge and its parent control, based on
anchorLeft
.var offsetRight: Double
Distance between the node’s right edge and its parent control, based on
anchorRight
.var offsetTop: Double
Distance between the node’s top edge and its parent control, based on
anchorTop
.var pivotOffset: Vector2
By default, the node’s pivot is its top-left corner. When you change its
rotation
orscale
, it will rotate or scale around this pivot. Set this property tosize
/ 2 to pivot around the Control’s center.var resized: SimpleSignal
Emitted when the control changes size.
var rotation: Double
The node’s rotation around its pivot, in radians. See
pivotOffset
to change the pivot’s position.var rotationDegrees: Double
Helper property to access
rotation
in degrees instead of radians.var scale: Vector2
The node’s scale, relative to its
size
. Change this property to scale the node around itspivotOffset
. The Control’stooltipText
will also scale according to this value.var shortcutContext: Node?
The
Node
which must be a parent of the focusedControl
for the shortcut to be activated. Ifnull
, the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused.var sizeFlagsChanged: SimpleSignal
Emitted when one of the size flags changes. See
sizeFlagsHorizontal
andsizeFlagsVertical
.var sizeFlagsHorizontal: Control.SizeFlags
Tells the parent
Container
nodes how they should resize and place the node on the X axis. Use a combination of theSizeFlags
constants to change the flags. See the constants to learn what each does.var sizeFlagsStretchRatio: Double
If the node and at least one of its neighbors uses the .sizeExpand size flag, the parent
Container
will let it take more or less space depending on this property. If this node has a stretch ratio of 2 and its neighbor a ratio of 1, this node will take two thirds of the available space.var sizeFlagsVertical: Control.SizeFlags
Tells the parent
Container
nodes how they should resize and place the node on the Y axis. Use a combination of theSizeFlags
constants to change the flags. See the constants to learn what each does.var theme: Theme?
The
Theme
resource this node and all itsControl
andWindow
children use. If a child node has its ownTheme
resource set, theme items are merged with child’s definitions having higher priority.var themeChanged: SimpleSignal
Emitted when the
notificationThemeChanged
notification is sent.var themeTypeVariation: StringName
The name of a theme type variation used by this
Control
to look up its own theme items. When empty, the class name of the node is used (e.g. [code skip-lint]Button` for theButton
control), as well as the class names of all parent classes (in order of inheritance).var tooltipText: String
The default tooltip text. The tooltip appears when the user’s mouse cursor stays idle over this control for a few moments, provided that the
mouseFilter
property is not .ignore. The time required for the tooltip to appear can be changed with theProjectSettings/gui/timers/tooltipDelaySec
option. See alsogetTooltip(atPosition:)
.func acceptEvent(
) Marks an input event as handled. Once you accept an input event, it stops propagating, even to nodes listening to
_unhandledInput(event:)
or_unhandledKeyInput(event:)
.func addThemeColorOverride(name: StringName, color: Color
) Creates a local override for a theme
Color
with the specifiedname
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeColorOverride(name:)
.func addThemeConstantOverride(name: StringName, constant: Int32
) Creates a local override for a theme constant with the specified
name
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeConstantOverride(name:)
.func addThemeFontOverride(name: StringName, font: Font?
) Creates a local override for a theme
Font
with the specifiedname
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeFontOverride(name:)
.func addThemeFontSizeOverride(name: StringName, fontSize: Int32
) Creates a local override for a theme font size with the specified
name
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeFontSizeOverride(name:)
.func addThemeIconOverride(name: StringName, texture: Texture2D?
) Creates a local override for a theme icon with the specified
name
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeIconOverride(name:)
.func addThemeStyleboxOverride(name: StringName, stylebox: StyleBox?
) Creates a local override for a theme
StyleBox
with the specifiedname
. Local overrides always take precedence when fetching theme items for the control. An override can be removed withremoveThemeStyleboxOverride(name:)
.func beginBulkThemeOverride(
) Prevents
*_theme_*_override
methods from emittingnotificationThemeChanged
untilendBulkThemeOverride
is called.func endBulkThemeOverride(
) Ends a bulk theme override update. See
beginBulkThemeOverride
.func findNextValidFocus(
) -> Control? Finds the next (below in the tree)
Control
that can receive the focus.func findPrevValidFocus(
) -> Control? Finds the previous (above in the tree)
Control
that can receive the focus.func findValidFocusNeighbor(side: Side
) -> Control? Finds the next
Control
that can receive the focus on the specifiedSide
.func forceDrag(data: Variant, preview: Control?
) Forces drag and bypasses
_getDragData(atPosition:)
andsetDragPreview(control:)
by passingdata
andpreview
. Drag will start even if the mouse is neither over nor pressed on this control.func getAnchor(side: Side
) -> Double Returns the anchor for the specified
Side
. A getter method foranchorBottom
,anchorLeft
,anchorRight
andanchorTop
.func getBegin(
) -> Vector2 Returns
offsetLeft
andoffsetTop
. See alsoposition
.func getCombinedMinimumSize(
) -> Vector2 Returns combined minimum size from
customMinimumSize
andgetMinimumSize
.func getCursorShape(position: Vector2
) -> Control.CursorShape Returns the mouse cursor shape the control displays on mouse hover. See
CursorShape
.func getEnd(
) -> Vector2 Returns
offsetRight
andoffsetBottom
.func getGlobalPosition(
) -> Vector2 func getGlobalRect(
) -> Rect2 Returns the position and size of the control relative to the containing canvas. See
globalPosition
andsize
.func getMinimumSize(
) -> Vector2 Returns the minimum size for this control. See
customMinimumSize
.func getParentAreaSize(
) -> Vector2 Returns the width/height occupied in the parent control.
func getParentControl(
) -> Control? Returns the parent control node.
func getPosition(
) -> Vector2 func getRect(
) -> Rect2 Returns the position and size of the control in the coordinate system of the containing node. See
position
,scale
andsize
.func getScreenPosition(
) -> Vector2 Returns the position of this
Control
in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins.func getSize(
) -> Vector2 func getThemeColor(name: StringName, themeType: StringName
) -> Color Returns a
Color
from the first matchingTheme
in the tree if thatTheme
has a color item with the specifiedname
andthemeType
. IfthemeType
is omitted the class name of the current control is used as the type, orthemeTypeVariation
if it is defined. If the type is a class name its parent classes are also checked, in order of inheritance. If the type is a variation its base types are checked, in order of dependency, then the control’s class name and its parent classes are checked.func getThemeConstant(name: StringName, themeType: StringName
) -> Int32 Returns a constant from the first matching
Theme
in the tree if thatTheme
has a constant item with the specifiedname
andthemeType
.func getThemeDefaultBaseScale(
) -> Double Returns the default base scale value from the first matching
Theme
in the tree if thatTheme
has a validdefaultBaseScale
value.func getThemeDefaultFont(
) -> Font? Returns the default font from the first matching
Theme
in the tree if thatTheme
has a validdefaultFont
value.func getThemeDefaultFontSize(
) -> Int32 Returns the default font size value from the first matching
Theme
in the tree if thatTheme
has a validdefaultFontSize
value.func getThemeFont(name: StringName, themeType: StringName
) -> Font? Returns a
Font
from the first matchingTheme
in the tree if thatTheme
has a font item with the specifiedname
andthemeType
.func getThemeFontSize(name: StringName, themeType: StringName
) -> Int32 Returns a font size from the first matching
Theme
in the tree if thatTheme
has a font size item with the specifiedname
andthemeType
.func getThemeIcon(name: StringName, themeType: StringName
) -> Texture2D? Returns an icon from the first matching
Theme
in the tree if thatTheme
has an icon item with the specifiedname
andthemeType
.func getThemeStylebox(name: StringName, themeType: StringName
) -> StyleBox? Returns a
StyleBox
from the first matchingTheme
in the tree if thatTheme
has a stylebox item with the specifiedname
andthemeType
.func getTooltip(atPosition: Vector2
) -> String Returns the tooltip text for the position
atPosition
in control’s local coordinates, which will typically appear when the cursor is resting over this control. By default, it returnstooltipText
.func grabClickFocus(
) Creates an
InputEventMouseButton
that attempts to click the control. If the event is received, the control acquires focus.func grabFocus(
) Steal the focus from another control and become the focused control (see
focusMode
).func hasFocus(
) -> Bool Returns
true
if this is the current focused control. SeefocusMode
.func hasThemeColor(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a color item with the specifiedname
andthemeType
.func hasThemeColorOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a themeColor
with the specifiedname
in thisControl
node.func hasThemeConstant(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a constant item with the specifiedname
andthemeType
.func hasThemeConstantOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a theme constant with the specifiedname
in thisControl
node.func hasThemeFont(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a font item with the specifiedname
andthemeType
.func hasThemeFontOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a themeFont
with the specifiedname
in thisControl
node.func hasThemeFontSize(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a font size item with the specifiedname
andthemeType
.func hasThemeFontSizeOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a theme font size with the specifiedname
in thisControl
node.func hasThemeIcon(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has an icon item with the specifiedname
andthemeType
.func hasThemeIconOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a theme icon with the specifiedname
in thisControl
node.func hasThemeStylebox(name: StringName, themeType: StringName
) -> Bool Returns
true
if there is a matchingTheme
in the tree that has a stylebox item with the specifiedname
andthemeType
.func hasThemeStyleboxOverride(name: StringName
) -> Bool Returns
true
if there is a local override for a themeStyleBox
with the specifiedname
in thisControl
node.func isDragSuccessful(
) -> Bool Returns
true
if a drag operation is successful. Alternative toguiIsDragSuccessful
.func isLayoutRtl(
) -> Bool Returns
true
if layout is right-to-left.func releaseFocus(
) Give up the focus. No other control will be able to receive input.
func removeThemeColorOverride(name: StringName
) Removes a local override for a theme
Color
with the specifiedname
previously added byaddThemeColorOverride(name:color:)
or via the Inspector dock.func removeThemeConstantOverride(name: StringName
) Removes a local override for a theme constant with the specified
name
previously added byaddThemeConstantOverride(name:constant:)
or via the Inspector dock.func removeThemeFontOverride(name: StringName
) Removes a local override for a theme
Font
with the specifiedname
previously added byaddThemeFontOverride(name:font:)
or via the Inspector dock.func removeThemeFontSizeOverride(name: StringName
) Removes a local override for a theme font size with the specified
name
previously added byaddThemeFontSizeOverride(name:fontSize:)
or via the Inspector dock.func removeThemeIconOverride(name: StringName
) Removes a local override for a theme icon with the specified
name
previously added byaddThemeIconOverride(name:texture:)
or via the Inspector dock.func removeThemeStyleboxOverride(name: StringName
) Removes a local override for a theme
StyleBox
with the specifiedname
previously added byaddThemeStyleboxOverride(name:stylebox:)
or via the Inspector dock.func resetSize(
) Resets the size to
getCombinedMinimumSize
. This is equivalent to callingset_size(Vector2())
(or any size below the minimum).func setAnchor(side: Side, anchor: Double, keepOffset: Bool, pushOppositeAnchor: Bool
) Sets the anchor for the specified
Side
toanchor
. A setter method foranchorBottom
,anchorLeft
,anchorRight
andanchorTop
.func setAnchorAndOffset(side: Side, anchor: Double, offset: Double, pushOppositeAnchor: Bool
) Works the same as
setAnchor(side:anchor:keepOffset:pushOppositeAnchor:)
, but instead ofkeep_offset
argument and automatic update of offset, it allows to set the offset yourself (seesetOffset(side:offset:)
).func setAnchorsAndOffsetsPreset(Control.LayoutPreset, resizeMode: Control.LayoutPresetMode, margin: Int32
) Sets both anchor preset and offset preset. See
setAnchorsPreset(_:keepOffsets:)
andsetOffsetsPreset(_:resizeMode:margin:)
.func setAnchorsPreset(Control.LayoutPreset, keepOffsets: Bool
) Sets the anchors to a
preset
fromControl.LayoutPreset
enum. This is the code equivalent to using the Layout menu in the 2D editor.func setBegin(position: Vector2
) Sets
offsetLeft
andoffsetTop
at the same time. Equivalent of changingposition
.func setDragForwarding(dragFunc: Callable, canDropFunc: Callable, dropFunc: Callable
) Forwards the handling of this control’s
_getDragData(atPosition:)
,_canDropData(atPosition:data:)
and_dropData(atPosition:data:)
virtual functions to delegate callables.func setDragPreview(control: Control?
) Shows the given control at the mouse pointer. A good time to call this method is in
_getDragData(atPosition:)
. The control must not be in the scene tree. You should not free the control, and you should not keep a reference to the control beyond the duration of the drag. It will be deleted automatically after the drag has ended.func setEnd(position: Vector2
) Sets
offsetRight
andoffsetBottom
at the same time.func setGlobalPosition(Vector2, keepOffsets: Bool
) Sets the
globalPosition
to givenposition
.func setOffsetsPreset(Control.LayoutPreset, resizeMode: Control.LayoutPresetMode, margin: Int32
) Sets the offsets to a
preset
fromControl.LayoutPreset
enum. This is the code equivalent to using the Layout menu in the 2D editor.func setPosition(Vector2, keepOffsets: Bool
) Sets the
position
to givenposition
.func setSize(Vector2, keepOffsets: Bool
) Sets the size (see
size
).func updateMinimumSize(
) Invalidates the size cache in this node and in parent nodes up to top level. Intended to be used with
getMinimumSize
when the return value is changed. SettingcustomMinimumSize
directly calls this method automatically.func warpMouse(position: Vector2
) Moves the mouse cursor to
position
, relative toposition
of thisControl
.
Show implementation details (9)
Hide implementation details
func _canDropData(atPosition: Vector2, data: Variant
) -> Bool Godot calls this method to test if
data
from a control’s_getDragData(atPosition:)
can be dropped atatPosition
.atPosition
is local to this control.func _dropData(atPosition: Vector2, data: Variant
) Godot calls this method to pass you the
data
from a control’s_getDragData(atPosition:)
result. Godot first calls_canDropData(atPosition:data:)
to test ifdata
is allowed to drop atatPosition
whereatPosition
is local to this control.func _getDragData(atPosition: Vector2
) -> Variant Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns
null
if there is no data to drag. Controls that want to receive drop data should implement_canDropData(atPosition:data:)
and_dropData(atPosition:data:)
.atPosition
is local to this control. Drag may be forced withforceDrag(data:preview:)
.func _getMinimumSize(
) -> Vector2 Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to
customMinimumSize
for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately).func _getTooltip(atPosition: Vector2
) -> String Virtual method to be implemented by the user. Returns the tooltip text for the position
atPosition
in control’s local coordinates, which will typically appear when the cursor is resting over this control. SeegetTooltip(atPosition:)
.func _guiInput(event: InputEvent?
) Virtual method to be implemented by the user. Use this method to process and accept inputs on UI elements. See
acceptEvent
.func _hasPoint(Vector2
) -> Bool Virtual method to be implemented by the user. Returns whether the given
point
is inside this control.func _makeCustomTooltip(forText: String
) -> Object? Virtual method to be implemented by the user. Returns a
Control
node that should be used as a tooltip instead of the default one. TheforText
includes the contents of thetooltipText
property.func _structuredTextParser(args: GArray, text: String
) -> VariantCollection<Vector3i> User defined BiDi algorithm override function.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
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 RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.