diff options
Diffstat (limited to 'scene/gui/popup.cpp')
| -rw-r--r-- | scene/gui/popup.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index c0a2dc81d0..b16e8371a2 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -33,10 +33,10 @@ #include "core/config/engine.h" #include "core/os/keyboard.h" #include "scene/gui/panel.h" +#include "scene/theme/theme_db.h" void Popup::_input_from_window(const Ref<InputEvent> &p_event) { - Ref<InputEventKey> key = p_event; - if (get_flag(FLAG_POPUP) && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) { + if (get_flag(FLAG_POPUP) && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) { _close_pressed(); } } @@ -68,12 +68,6 @@ void Popup::_deinitialize_visible_parents() { } } -void Popup::_update_theme_item_cache() { - Window::_update_theme_item_cache(); - - theme_cache.panel_style = get_theme_stylebox(SNAME("panel")); -} - void Popup::_notification(int p_what) { switch (p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { @@ -136,10 +130,6 @@ void Popup::_post_popup() { popped_up = true; } -void Popup::_bind_methods() { - ADD_SIGNAL(MethodInfo("popup_hide")); -} - void Popup::_validate_property(PropertyInfo &p_property) const { if ( p_property.name == "transient" || @@ -201,6 +191,12 @@ Rect2i Popup::_popup_adjust_rect() const { return current; } +void Popup::_bind_methods() { + ADD_SIGNAL(MethodInfo("popup_hide")); + + BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, Popup, panel_style, "panel"); +} + Popup::Popup() { set_wrap_controls(true); set_visible(false); @@ -260,12 +256,6 @@ void PopupPanel::_update_child_rects() { } } -void PopupPanel::_update_theme_item_cache() { - Popup::_update_theme_item_cache(); - - theme_cache.panel_style = get_theme_stylebox(SNAME("panel")); -} - void PopupPanel::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: @@ -280,6 +270,10 @@ void PopupPanel::_notification(int p_what) { } } +void PopupPanel::_bind_methods() { + BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, PopupPanel, panel_style, "panel"); +} + PopupPanel::PopupPanel() { panel = memnew(Panel); add_child(panel, false, INTERNAL_MODE_FRONT); |
