summaryrefslogtreecommitdiffstats
path: root/scene/gui/popup.cpp
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2023-09-08 21:00:10 +0200
committerYuri Sizov <yuris@humnom.net>2023-09-11 13:45:23 +0200
commit2924bfd4d3c6dbdf01df3263000070634826f0a9 (patch)
tree779d2aa57557af3c2fe2828e6a3a570a32e7a61b /scene/gui/popup.cpp
parent8c1817f755b63a69378774d8d0f74499f663afe2 (diff)
downloadredot-engine-2924bfd4d3c6dbdf01df3263000070634826f0a9.tar.gz
Register theme properties with ThemeDB
Diffstat (limited to 'scene/gui/popup.cpp')
-rw-r--r--scene/gui/popup.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 6915f3d242..b16e8371a2 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -33,6 +33,7 @@
#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) {
if (get_flag(FLAG_POPUP) && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) {
@@ -67,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: {
@@ -135,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" ||
@@ -200,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);
@@ -259,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:
@@ -279,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);