Enumerationmigueldeicaza.swiftgodot 0.46.0SwiftGodot
MenuItems
RichTextLabel.swift:58enum MenuItems
Cases
case copy
Copies the selected text.
case selectAll
Selects the whole
RichTextLabel
text.case max
Represents the size of the
MenuItems
enum.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (104) members.
Types
struct ImageUpdateMask
enum ListType
enum MetaUnderline
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
Type members
Instance members
var autowrapMode: TextServer.AutowrapMode
If set to something other than
TextServer/AutowrapMode/autowrapOff
, the text gets wrapped inside the node’s bounding rectangle. To see how each mode behaves, seeTextServer.AutowrapMode
.var bbcodeEnabled: Bool
If
true
, the label uses BBCode formatting.var contextMenuEnabled: Bool
If
true
, a right-click displays the context menu.var customEffects: GArray
The currently installed custom effects. This is an array of
RichTextEffect
s.var deselectOnFocusLossEnabled: Bool
If
true
, the selected text will be deselected when focus is lost.var dragAndDropSelectionEnabled: Bool
If
true
, allow drag and drop of selected text.var finished: SimpleSignal
Triggered when the document is fully loaded.
var fitContent: Bool
If
true
, the label’s minimum size will be automatically updated to fit its content, matching the behavior ofLabel
.var hintUnderlined: Bool
If
true
, the label underlines hint tags such as [code skip-lint][hint=description]{text}[/hint]`.var language: String
Language code used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
var metaClicked: Signal1
Triggered when the user clicks on content between meta (URL) tags. If the meta is defined in BBCode, e.g. [code skip-lint]<a href=”{“key”: “value”}”>Text`, then the parameter for this signal will always be a
String
type. If a particular type or an object is desired, the ``pushMeta(data:underlineMode:)`` method must be used to manually insert the data into the tag stack. Alternatively, you can convert the ``String`` input to the desired type based on its contents (such as calling ``JSON/parse(jsonText:keepText:)`` on it).var metaHoverEnded: Signal3
Triggers when the mouse exits a meta tag.
var metaHoverStarted: Signal2
Triggers when the mouse enters a meta tag.
var metaUnderlined: Bool
If
true
, the label underlines meta tags such as [code skip-lint][url]{text}`. These tags can call a function when clicked if [signal meta_clicked] is connected to a function.var progressBarDelay: Int32
The delay after which the loading progress bar is displayed, in milliseconds. Set to
-1
to disable progress bar entirely.var scrollActive: Bool
If
true
, the scrollbar is visible. Setting this tofalse
does not block scrolling completely. SeescrollToLine(_:)
.var scrollFollowing: Bool
If
true
, the window scrolls down to display new content automatically.var selectionEnabled: Bool
If
true
, the label allows text selection.var shortcutKeysEnabled: Bool
If
true
, shortcut keys for context menu items are enabled, even if the context menu is disabled.var structuredTextBidiOverride: TextServer.StructuredTextParser
Set BiDi algorithm override for the structured text.
var structuredTextBidiOverrideOptions: GArray
Set additional options for BiDi override.
var tabSize: Int32
The number of spaces associated with a single tab length. Does not affect
\t
in text tags, only indent tags.var text: String
The label’s text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.
var textDirection: Control.TextDirection
Base text writing direction.
var threaded: Bool
If
true
, text processing is done in a background thread.var visibleCharacters: Int32
The number of characters to display. If set to
-1
, all characters are displayed. This can be useful when animating the text appearing in a dialog box.var visibleCharactersBehavior: TextServer.VisibleCharactersBehavior
Sets the clipping behavior when
visibleCharacters
orvisibleRatio
is set. SeeTextServer.VisibleCharactersBehavior
for more info.var visibleRatio: Double
The fraction of characters to display, relative to the total number of characters (see
getTotalCharacterCount
). If set to1.0
, all characters are displayed. If set to0.5
, only half of the characters will be displayed. This can be useful when animating the text appearing in a dialog box.func addImage(Texture2D?, width: Int32, height: Int32, color: Color, inlineAlign: InlineAlignment, region: Rect2, key: Variant, pad: Bool, tooltip: String, sizeInPercent: Bool
) Adds an image’s opening and closing tags to the tag stack, optionally providing a
width
andheight
to resize the image, acolor
to tint the image and aregion
to only use parts of the image.func addText(String
) Adds raw non-BBCode-parsed text to the tag stack.
func appendText(bbcode: String
) Parses
bbcode
and adds tags to the tag stack as needed.func clear(
) Clears the tag stack, causing the label to display nothing.
func deselect(
) Clears the current selection.
func getCharacterLine(character: Int32
) -> Int32 Returns the line number of the character position provided. Line and character numbers are both zero-indexed.
func getCharacterParagraph(character: Int32
) -> Int32 Returns the paragraph number of the character position provided. Paragraph and character numbers are both zero-indexed.
func getContentHeight(
) -> Int32 Returns the height of the content.
func getContentWidth(
) -> Int32 Returns the width of the content.
func getLineCount(
) -> Int32 Returns the total number of lines in the text. Wrapped text is counted as multiple lines.
func getLineOffset(line: Int32
) -> Double Returns the vertical offset of the line found at the provided index.
func getMenu(
) -> PopupMenu? Returns the
PopupMenu
of thisRichTextLabel
. By default, this menu is displayed when right-clicking on theRichTextLabel
.func getParagraphCount(
) -> Int32 Returns the total number of paragraphs (newlines or
p
tags in the tag stack’s text tags). Considers wrapped text as one paragraph.func getParagraphOffset(paragraph: Int32
) -> Double Returns the vertical offset of the paragraph found at the provided index.
func getParsedText(
) -> String Returns the text without BBCode mark-up.
func getSelectedText(
) -> String Returns the current selection text. Does not include BBCodes.
func getSelectionFrom(
) -> Int32 Returns the current selection first character index if a selection is active,
-1
otherwise. Does not include BBCodes.func getSelectionTo(
) -> Int32 Returns the current selection last character index if a selection is active,
-1
otherwise. Does not include BBCodes.func getTotalCharacterCount(
) -> Int32 Returns the total number of characters from text tags. Does not include BBCodes.
func getVScrollBar(
) -> VScrollBar? Returns the vertical scrollbar.
func getVisibleLineCount(
) -> Int32 Returns the number of visible lines.
func getVisibleParagraphCount(
) -> Int32 Returns the number of visible paragraphs. A paragraph is considered visible if at least one of its lines is visible.
func installEffect(Variant
) Installs a custom effect. This can also be done in the RichTextLabel inspector using the
customEffects
property.effect
should be a validRichTextEffect
.func invalidateParagraph(Int32
) -> Bool Invalidates
paragraph
and all subsequent paragraphs cache.func isMenuVisible(
) -> Bool Returns whether the menu is visible. Use this instead of
get_menu().visible
to improve performance (so the creation of the menu is avoided).func isReady(
) -> Bool If
threaded
is enabled, returnstrue
if the background thread has finished text processing, otherwise always returntrue
.func newline(
) Adds a newline tag to the tag stack.
func parseBbcode(String
) The assignment version of
appendText(bbcode:)
. Clears the tag stack and inserts the new content.func parseExpressionsForValues(expressions: PackedStringArray
) -> GDictionary Parses BBCode parameter
expressions
into a dictionary.func pop(
) Terminates the current tag. Use after
push_*
methods to close BBCodes manually. Does not need to followadd_*
methods.func popAll(
) Terminates all tags opened by
push_*
methods.func popContext(
) Terminates tags opened after the last
pushContext
call (including context marker), or all tags if there’s no context marker on the stack.func pushBgcolor(Color
) Adds a [code skip-lint][bgcolor]` tag to the tag stack.
func pushBold(
) Adds a [code skip-lint][font]
tag with a bold font to the tag stack. This is the same as adding a [code skip-lint]**
tag if not currently in a [code skip-lint]_` tag.func pushBoldItalics(
) Adds a [code skip-lint][font]` tag with a bold italics font to the tag stack.
func pushCell(
) Adds a [code skip-lint][cell]
tag to the tag stack. Must be inside a [code skip-lint][table]
tag. SeepushTable(columns:inlineAlign:alignToRow:)
for details. UsesetTableColumnExpand(column:expand:ratio:)
to set column expansion ratio,setCellBorderColor(_:)
to set cell border,setCellRowBackgroundColor(oddRowBg:evenRowBg:)
to set cell background,setCellSizeOverride(minSize:maxSize:)
to override cell size, andsetCellPadding(_:)
to set padding.func pushColor(Color
) Adds a [code skip-lint][color]` tag to the tag stack.
func pushContext(
) Adds a context marker to the tag stack. See
popContext
.func pushCustomfx(effect: RichTextEffect?, env: GDictionary
) Adds a custom effect tag to the tag stack. The effect does not need to be in
customEffects
. The environment is directly passed to the effect.func pushDropcap(string: String, font: Font?, size: Int32, dropcapMargins: Rect2, color: Color, outlineSize: Int32, outlineColor: Color
) Adds a [code skip-lint][dropcap]` tag to the tag stack. Drop cap (dropped capital) is a decorative element at the beginning of a paragraph that is larger than the rest of the text.
func pushFgcolor(Color
) Adds a [code skip-lint][fgcolor]` tag to the tag stack.
func pushFont(Font?, fontSize: Int32
) Adds a [code skip-lint][font]` tag to the tag stack. Overrides default fonts for its duration.
func pushFontSize(Int32
) Adds a [code skip-lint][font_size]` tag to the tag stack. Overrides default font size for its duration.
func pushHint(description: String
) Adds a [code skip-lint][hint]
tag to the tag stack. Same as BBCode [code skip-lint][hint=something]{text}[/hint]
.func pushIndent(level: Int32
) Adds an [code skip-lint][indent]
tag to the tag stack. Multiplies
level` by currenttabSize
to determine new margin length.func pushItalics(
) Adds a [code skip-lint][font]
tag with an italics font to the tag stack. This is the same as adding an [code skip-lint]_
tag if not currently in a [code skip-lint]**` tag.func pushLanguage(String
) Adds language code used for text shaping algorithm and Open-Type font features.
func pushList(level: Int32, type: RichTextLabel.ListType, capitalize: Bool, bullet: String
) Adds [code skip-lint][ol]
or [code skip-lint][ul]
tag to the tag stack. Multiplieslevel
by currenttabSize
to determine new margin length.func pushMeta(data: Variant, underlineMode: RichTextLabel.MetaUnderline
) Adds a meta tag to the tag stack. Similar to the BBCode [code skip-lint]{text}`, but supports non-
String
metadata types.func pushMono(
) Adds a [code skip-lint][font]` tag with a monospace font to the tag stack.
func pushNormal(
) Adds a [code skip-lint][font]` tag with a normal font to the tag stack.
func pushOutlineColor(Color
) Adds a [code skip-lint][outline_color]` tag to the tag stack. Adds text outline for its duration.
func pushOutlineSize(Int32
) Adds a [code skip-lint][outline_size]` tag to the tag stack. Overrides default text outline size for its duration.
func pushParagraph(alignment: HorizontalAlignment, baseDirection: Control.TextDirection, language: String, stParser: TextServer.StructuredTextParser, justificationFlags: TextServer.JustificationFlag, tabStops: PackedFloat32Array
) Adds a [code skip-lint][p]` tag to the tag stack.
func pushStrikethrough(
) Adds a [code skip-lint][s]` tag to the tag stack.
func pushTable(columns: Int32, inlineAlign: InlineAlignment, alignToRow: Int32
) Adds a [code skip-lint][table=columns,inline_align]` tag to the tag stack. Use
setTableColumnExpand(column:expand:ratio:)
to set column expansion ratio. Use ``pushCell()`` to add cells.func pushUnderline(
) Adds a [code skip-lint][u]` tag to the tag stack.
func removeParagraph(Int32, noInvalidate: Bool
) -> Bool Removes a paragraph of content from the label. Returns
true
if the paragraph exists.func scrollToLine(Int32
) Scrolls the window’s top line to match
line
.func scrollToParagraph(Int32
) Scrolls the window’s top line to match first line of the
paragraph
.func scrollToSelection(
) Scrolls to the beginning of the current selection.
func selectAll(
) Select all the text.
func setCellBorderColor(Color
) Sets color of a table cell border.
func setCellPadding(Rect2
) Sets inner padding of a table cell.
func setCellRowBackgroundColor(oddRowBg: Color, evenRowBg: Color
) Sets color of a table cell. Separate colors for alternating rows can be specified.
func setCellSizeOverride(minSize: Vector2, maxSize: Vector2
) Sets minimum and maximum size overrides for a table cell.
func setTableColumnExpand(column: Int32, expand: Bool, ratio: Int32
) Edits the selected column’s expansion options. If
expand
istrue
, the column expands in proportion to its expansion ratio versus the other columns’ ratios.func updateImage(key: Variant, mask: RichTextLabel.ImageUpdateMask, image: Texture2D?, width: Int32, height: Int32, color: Color, inlineAlign: InlineAlignment, region: Rect2, pad: Bool, tooltip: String, sizeInPercent: Bool
) Updates the existing images with the key
key
. Only properties specified bymask
bits are updated. SeeaddImage(_:width:height:color:inlineAlign:region:key:pad:tooltip:sizeInPercent:)
.
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.