MiniEngine/include/SDLWrapper/MessageBox.h

46 lines
1.2 KiB
C++
Raw Normal View History

2017-06-18 20:37:45 +08:00
#pragma once
#include "include.h"
2018-03-04 15:10:49 +08:00
#include "MessageBoxType.h"
2017-06-18 20:37:45 +08:00
#include <string>
#include <functional>
#include <vector>
2018-03-04 15:10:49 +08:00
namespace MiniEngine {
2017-06-18 20:37:45 +08:00
class WindowMessageBoxButton
{
public:
WindowMessageBoxButton();
WindowMessageBoxButton(const std::string& ButtonText,const std::function<void()>& CallbackFunc=[]() {});
std::string text;
std::function<void()> callback;
/// Default: no hit option set.
void setHitAsReturn(bool);
void setHitAsEscape(bool);
bool isHitAsReturn() const;
bool isHitAsEscape() const;
private:
int _hitoption;
};
class WindowMessageBox
{
public:
WindowMessageBox();
WindowMessageBox(const std::string& Title,const std::string& Text,MessageBoxType BoxType=MessageBoxType::Information,const std::function<void()>& DefaultCallback=[]() {});
MessageBoxType boxtype;
std::string title;
std::string text;
std::function<void()> defaultcallback;
void addButton(const WindowMessageBoxButton& button);
int getButtonNum() const;
WindowMessageBoxButton& getButton(int index);
const WindowMessageBoxButton& getButtonConst(int index) const;
private:
std::vector<WindowMessageBoxButton> _vec;
};
2018-03-04 15:10:49 +08:00
} /// End of namespace MiniEngine