2018-09-11 19:38:59 +02:00
|
|
|
tool
|
2019-10-10 22:43:34 +02:00
|
|
|
extends HBoxContainer
|
|
|
|
|
|
|
|
var text setget set_text, get_text
|
|
|
|
|
|
|
|
signal label_changed(new_label)
|
2018-09-10 08:00:03 +02:00
|
|
|
|
|
|
|
func _ready():
|
|
|
|
pass
|
|
|
|
|
2019-10-10 22:43:34 +02:00
|
|
|
func get_text():
|
|
|
|
return $Label.text
|
|
|
|
|
|
|
|
func set_text(t):
|
|
|
|
$Label.text = t
|
|
|
|
|
2018-09-10 08:00:03 +02:00
|
|
|
func _on_gui_input(ev):
|
2019-10-10 22:43:34 +02:00
|
|
|
if ev is InputEventMouseButton and ev.pressed and ev.button_index == BUTTON_LEFT:
|
|
|
|
$Label.visible = false
|
|
|
|
$Editor.text = $Label.text
|
|
|
|
$Editor.visible = true
|
|
|
|
$Editor.select()
|
|
|
|
$Editor.grab_focus()
|
|
|
|
|
|
|
|
func _on_Editor_text_entered(__):
|
|
|
|
_on_Editor_focus_exited()
|
|
|
|
|
|
|
|
func _on_Editor_focus_exited():
|
|
|
|
$Label.text = $Editor.text
|
|
|
|
$Label.visible = true
|
|
|
|
$Editor.visible = false
|
|
|
|
emit_signal("label_changed", $Editor.text)
|