Platform: Add MessageBox
This commit is contained in:
70
include/Nazara/Platform/MessageBox.inl
Normal file
70
include/Nazara/Platform/MessageBox.inl
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Platform module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
#include <Nazara/Platform/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline MessageBox::MessageBox(MessageBoxType type, std::string title, std::string message) :
|
||||
m_message(std::move(message)),
|
||||
m_title(std::move(title)),
|
||||
m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
inline void MessageBox::AddButton(int id, std::string text, MessageBoxButtonRole role)
|
||||
{
|
||||
m_buttons.push_back({
|
||||
.role = role,
|
||||
.text = std::move(text),
|
||||
.buttonId = id
|
||||
});
|
||||
}
|
||||
|
||||
inline auto MessageBox::GetColorSchemeOverride() const -> const ColorScheme*
|
||||
{
|
||||
if (!m_colorSchemeOverride)
|
||||
return nullptr;
|
||||
|
||||
return &m_colorSchemeOverride.value();
|
||||
}
|
||||
|
||||
inline const std::string& MessageBox::GetMessage() const
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
inline const std::string& Nz::MessageBox::GetTitle() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
inline void MessageBox::OverrideColorScheme(const ColorScheme& colorScheme)
|
||||
{
|
||||
m_colorSchemeOverride = colorScheme;
|
||||
}
|
||||
|
||||
inline void MessageBox::ResetColorScheme()
|
||||
{
|
||||
m_colorSchemeOverride = std::nullopt;
|
||||
}
|
||||
|
||||
inline void MessageBox::UpdateMessage(std::string message)
|
||||
{
|
||||
m_message = std::move(message);
|
||||
}
|
||||
|
||||
inline void MessageBox::UpdateTitle(std::string title)
|
||||
{
|
||||
m_title = std::move(title);
|
||||
}
|
||||
|
||||
inline void MessageBox::UpdateType(MessageBoxType type)
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Platform/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user