diff options
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r-- | editor/editor_properties.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 5f1e7273e5..3c3df6b8ef 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -258,19 +258,40 @@ void EditorPropertyPath::setup(const Vector<String> &p_extensions, bool p_folder global = p_global; } +void EditorPropertyPath::_notification(int p_what) { + + if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { + path_edit->set_icon(get_icon("Folder", "EditorIcons")); + } +} + +void EditorPropertyPath::_path_focus_exited() { + + _path_selected(path->get_text()); +} + void EditorPropertyPath::_bind_methods() { ClassDB::bind_method(D_METHOD("_path_pressed"), &EditorPropertyPath::_path_pressed); ClassDB::bind_method(D_METHOD("_path_selected"), &EditorPropertyPath::_path_selected); + ClassDB::bind_method(D_METHOD("_path_focus_exited"), &EditorPropertyPath::_path_focus_exited); } EditorPropertyPath::EditorPropertyPath() { - path = memnew(Button); - path->set_clip_text(true); - add_child(path); + HBoxContainer *path_hb = memnew(HBoxContainer); + add_child(path_hb); + path = memnew(LineEdit); + path_hb->add_child(path); + path->connect("text_entered", this, "_path_selected"); + path->connect("focus_exited", this, "_path_focus_exited"); + path->set_h_size_flags(SIZE_EXPAND_FILL); + + path_edit = memnew(Button); + path_edit->set_clip_text(true); + path_hb->add_child(path_edit); add_focusable(path); dialog = NULL; - path->connect("pressed", this, "_path_pressed"); + path_edit->connect("pressed", this, "_path_pressed"); folder = false; global = false; } |