From 2ba847cf58fe8ef6b2ea9c4b7d41a03993ea2e66 Mon Sep 17 00:00:00 2001 From: turanszkij Date: Sat, 11 Apr 2020 19:17:15 +0100 Subject: [PATCH] gui update: put newly appearing windows on top --- Editor/MaterialWindow.cpp | 1 + WickedEngine/wiGUI.cpp | 7 +++++++ WickedEngine/wiVersion.cpp | 2 +- WickedEngine/wiWidget.cpp | 12 ++++++++++-- WickedEngine/wiWidget.h | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Editor/MaterialWindow.cpp b/Editor/MaterialWindow.cpp index 67b9395cb..72cce0bf8 100644 --- a/Editor/MaterialWindow.cpp +++ b/Editor/MaterialWindow.cpp @@ -367,6 +367,7 @@ MaterialWindow::MaterialWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) y = 0; materialNameField = new wiTextInputField("MaterialName"); + materialNameField->SetTooltip("Set a name for the material..."); materialNameField->SetPos(XMFLOAT2(10, y += step)); materialNameField->SetSize(XMFLOAT2(300, 25)); materialNameField->OnInputAccepted([&](wiEventArgs args) { diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index 12ba00513..c357e95b6 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -106,6 +106,12 @@ void wiGUI::Update(float dt) { focus = true; } + + if (widget->priority_change) + { + widget->priority_change = false; + priorityChangeQueue.push_back(widget); + } } for (auto& widget : priorityChangeQueue) @@ -184,6 +190,7 @@ void wiGUI::ActivateWidget(wiWidget* widget) { if (std::find(widgets.begin(), widgets.end(), widget) != widgets.end()) { + widget->priority_change = false; priorityChangeQueue.push_back(widget); } if (activeWidget == nullptr) diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 5bf37a8c4..24b527d8a 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 39; // minor bug fixes, alterations, refactors, updates - const int revision = 56; + const int revision = 57; long GetVersion() diff --git a/WickedEngine/wiWidget.cpp b/WickedEngine/wiWidget.cpp index 6371a4397..fbfe378b3 100644 --- a/WickedEngine/wiWidget.cpp +++ b/WickedEngine/wiWidget.cpp @@ -188,7 +188,11 @@ wiWidget::WIDGETSTATE wiWidget::GetState() const } void wiWidget::SetEnabled(bool val) { - enabled = val; + if (enabled != val) + { + priority_change |= val; + enabled = val; + } } bool wiWidget::IsEnabled() const { @@ -196,7 +200,11 @@ bool wiWidget::IsEnabled() const } void wiWidget::SetVisible(bool val) { - visible = val; + if (visible != val) + { + priority_change |= val; + visible = val; + } } bool wiWidget::IsVisible() const { diff --git a/WickedEngine/wiWidget.h b/WickedEngine/wiWidget.h index 2095b37e9..ec973f65a 100644 --- a/WickedEngine/wiWidget.h +++ b/WickedEngine/wiWidget.h @@ -47,7 +47,7 @@ protected: std::string scriptTip; bool enabled = true; bool visible = true; - uint32_t foregroundPriority = 0; + bool priority_change = true; WIDGETSTATE state = IDLE; void Activate();