Added EditorCommandPalette

This commit is contained in:
Bhuvan Vemula 2021-05-29 18:58:16 +05:30
parent 504eb48214
commit a0a019a998
15 changed files with 576 additions and 59 deletions

View file

@ -32,6 +32,7 @@
#include "core/input/input_map.h"
#include "core/os/keyboard.h"
#include "scene/gui/shortcut.h"
const int InputEvent::DEVICE_ID_TOUCH_MOUSE = -1;
const int InputEvent::DEVICE_ID_INTERNAL = -2;
@ -1512,3 +1513,26 @@ void InputEventMIDI::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_number"), "set_controller_number", "get_controller_number");
ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_value"), "set_controller_value", "get_controller_value");
}
///////////////////////////////////
void InputEventShortcut::set_shortcut(Ref<Shortcut> p_shortcut) {
shortcut = p_shortcut;
emit_changed();
}
Ref<Shortcut> InputEventShortcut::get_shortcut() {
return shortcut;
}
bool InputEventShortcut::is_pressed() const {
return true;
}
String InputEventShortcut::as_text() const {
return vformat(RTR("Input Event with Shortcut=%s"), shortcut->get_as_text());
}
String InputEventShortcut::to_string() {
return vformat("InputEventShortcut: shortcut=%s", shortcut->get_as_text());
}

View file

@ -42,6 +42,8 @@
* The events are pretty obvious.
*/
class Shortcut;
/**
* Input Modifier Status
* for keyboard/mouse events.
@ -538,4 +540,18 @@ public:
InputEventMIDI() {}
};
class InputEventShortcut : public InputEvent {
GDCLASS(InputEventShortcut, InputEvent);
Ref<Shortcut> shortcut;
public:
void set_shortcut(Ref<Shortcut> p_shortcut);
Ref<Shortcut> get_shortcut();
virtual bool is_pressed() const override;
virtual String as_text() const override;
virtual String to_string() override;
};
#endif // INPUT_EVENT_H