]> Untitled Git - wolf-seeking-sheep.git/blob - addons/dialogic/Editor/Events/Fields/field_text_multiline.gd
Initial Godot project with Dialogic 2.0-Alpha-17
[wolf-seeking-sheep.git] / addons / dialogic / Editor / Events / Fields / field_text_multiline.gd
1 @tool
2 extends DialogicVisualEditorField
3
4 ## Event block field that allows entering multiline text (mainly text event).
5
6 @onready var code_completion_helper: Node = find_parent('EditorsManager').get_node('CodeCompletionHelper')
7
8
9 #region MAIN METHODS
10 ################################################################################
11
12 func _ready() -> void:
13         self.text_changed.connect(_on_text_changed)
14         self.syntax_highlighter = code_completion_helper.text_syntax_highlighter
15
16
17 func _load_display_info(info:Dictionary) -> void:
18         pass
19
20
21 func _set_value(value:Variant) -> void:
22         self.text = str(value)
23
24
25 func _autofocus() -> void:
26         grab_focus()
27
28 #endregion
29
30
31 #region SIGNAL METHODS
32 ################################################################################
33
34 func _on_text_changed(value := "") -> void:
35         value_changed.emit(property_name, self.text)
36
37 #endregion
38
39
40 #region AUTO COMPLETION
41 ################################################################################
42
43 ## Called if something was typed
44 func _request_code_completion(force:bool):
45         code_completion_helper.request_code_completion(force, self, 0)
46
47
48 ## Filters the list of all possible options, depending on what was typed
49 ## Purpose of the different Kinds is explained in [_request_code_completion]
50 func _filter_code_completion_candidates(candidates:Array) -> Array:
51         return code_completion_helper.filter_code_completion_candidates(candidates, self)
52
53
54 ## Called when code completion was activated
55 ## Inserts the selected item
56 func _confirm_code_completion(replace:bool) -> void:
57         code_completion_helper.confirm_code_completion(replace, self)
58
59 #endregion
60
61
62 #region SYMBOL CLICKING
63 ################################################################################
64
65 ## Performs an action (like opening a link) when a valid symbol was clicked
66 func _on_symbol_lookup(symbol, line, column):
67         code_completion_helper.symbol_lookup(symbol, line, column)
68
69
70 ## Called to test if a symbol can be clicked
71 func _on_symbol_validate(symbol:String) -> void:
72         code_completion_helper.symbol_validate(symbol, self)
73
74 #endregion