diff options
Diffstat (limited to 'scene/gui/shortcut.cpp')
-rw-r--r-- | scene/gui/shortcut.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/scene/gui/shortcut.cpp b/scene/gui/shortcut.cpp index 262d8076f3..f8c7bc44a7 100644 --- a/scene/gui/shortcut.cpp +++ b/scene/gui/shortcut.cpp @@ -32,47 +32,42 @@ #include "core/os/keyboard.h" -void ShortCut::set_shortcut(const Ref<InputEvent> &p_shortcut) { - +void Shortcut::set_shortcut(const Ref<InputEvent> &p_shortcut) { shortcut = p_shortcut; emit_changed(); } -Ref<InputEvent> ShortCut::get_shortcut() const { - +Ref<InputEvent> Shortcut::get_shortcut() const { return shortcut; } -bool ShortCut::is_shortcut(const Ref<InputEvent> &p_event) const { - +bool Shortcut::is_shortcut(const Ref<InputEvent> &p_event) const { return shortcut.is_valid() && shortcut->shortcut_match(p_event); } -String ShortCut::get_as_text() const { - - if (shortcut.is_valid()) +String Shortcut::get_as_text() const { + if (shortcut.is_valid()) { return shortcut->as_text(); - else + } else { return "None"; + } } -bool ShortCut::is_valid() const { - +bool Shortcut::is_valid() const { return shortcut.is_valid(); } -void ShortCut::_bind_methods() { - - ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &ShortCut::set_shortcut); - ClassDB::bind_method(D_METHOD("get_shortcut"), &ShortCut::get_shortcut); +void Shortcut::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_shortcut", "event"), &Shortcut::set_shortcut); + ClassDB::bind_method(D_METHOD("get_shortcut"), &Shortcut::get_shortcut); - ClassDB::bind_method(D_METHOD("is_valid"), &ShortCut::is_valid); + ClassDB::bind_method(D_METHOD("is_valid"), &Shortcut::is_valid); - ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &ShortCut::is_shortcut); - ClassDB::bind_method(D_METHOD("get_as_text"), &ShortCut::get_as_text); + ClassDB::bind_method(D_METHOD("is_shortcut", "event"), &Shortcut::is_shortcut); + ClassDB::bind_method(D_METHOD("get_as_text"), &Shortcut::get_as_text); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shortcut", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), "set_shortcut", "get_shortcut"); } -ShortCut::ShortCut() { +Shortcut::Shortcut() { } |