use localized text for popup manager
This commit is contained in:
parent
8a2d118641
commit
4f2e03c228
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <NazaraEditor/Core/Core.hpp>
|
#include <NazaraEditor/Core/Core.hpp>
|
||||||
|
#include <NazaraLocalization/LocalizedText.hpp>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -11,11 +12,11 @@ namespace Nz
|
||||||
{
|
{
|
||||||
struct Choice
|
struct Choice
|
||||||
{
|
{
|
||||||
std::string name;
|
Nz::LocalizedText name;
|
||||||
std::function<void(void)> callback;
|
std::function<void(void)> callback;
|
||||||
};
|
};
|
||||||
std::string title;
|
Nz::LocalizedText title;
|
||||||
std::string description;
|
Nz::LocalizedText description;
|
||||||
std::vector<Choice> choices;
|
std::vector<Choice> choices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,15 @@ namespace Nz
|
||||||
void EditorAction_Level_New::Execute()
|
void EditorAction_Level_New::Execute()
|
||||||
{
|
{
|
||||||
Nz::EditorBaseApplication::Instance()->GetPopupManager().CreatePopup({
|
Nz::EditorBaseApplication::Instance()->GetPopupManager().CreatePopup({
|
||||||
.title = "Warning",
|
.title = "LOC_EDITOR_POPUP_CREATE_LEVEL_TITLE",
|
||||||
.description = "Are you sure you want to create a new level?",
|
.description = "LOC_EDITOR_POPUP_CREATE_LEVEL_DESC",
|
||||||
.choices = {
|
.choices = {
|
||||||
{
|
{
|
||||||
.name = "Yes",
|
.name = "LOC_EDITOR_YES",
|
||||||
.callback = []() { Nz::EditorBaseApplication::Instance()->NewLevel(); }
|
.callback = []() { Nz::EditorBaseApplication::Instance()->NewLevel(); }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "No"
|
.name = "LOC_EDITOR_NO"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,10 @@ namespace Nz
|
||||||
|
|
||||||
void EditorPopup::OnRenderImgui()
|
void EditorPopup::OnRenderImgui()
|
||||||
{
|
{
|
||||||
ImGui::OpenPopup(m_parameters.title.c_str());
|
std::string name = std::format("{}###{}", m_parameters.title.ToString(), m_parameters.title.GetBaseString());
|
||||||
if (ImGui::BeginPopupModal(m_parameters.title.c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse))
|
|
||||||
|
ImGui::OpenPopup(name.c_str());
|
||||||
|
if (ImGui::BeginPopupModal(name.c_str(), nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse))
|
||||||
{
|
{
|
||||||
ImGui::Text(m_parameters.description.c_str());
|
ImGui::Text(m_parameters.description.c_str());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue