2022-09-27 18:15:20 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "MDTextArea.hpp"
|
|
|
|
#include "Popup.hpp"
|
|
|
|
|
|
|
|
namespace geode {
|
|
|
|
/**
|
2023-01-24 17:07:15 -05:00
|
|
|
* FLAlertLayer with support for Markdown. See MDTextArea
|
2022-09-27 18:15:20 -04:00
|
|
|
* for details on what features of MD are supported.
|
|
|
|
*/
|
2022-10-30 14:59:20 -04:00
|
|
|
class MDPopup :
|
|
|
|
public Popup<
|
|
|
|
std::string const&, std::string const&, char const*, char const*,
|
2023-02-08 10:25:07 -05:00
|
|
|
utils::MiniFunction<void(bool)>> {
|
2022-09-27 18:15:20 -04:00
|
|
|
protected:
|
2023-02-08 10:25:07 -05:00
|
|
|
utils::MiniFunction<void(bool)> m_onClick = nullptr;
|
2022-09-29 08:17:02 -04:00
|
|
|
|
2022-09-27 18:15:20 -04:00
|
|
|
bool setup(
|
2022-10-30 14:59:20 -04:00
|
|
|
std::string const& title, std::string const& info, char const* btn1, char const* btn2,
|
2023-02-08 10:25:07 -05:00
|
|
|
utils::MiniFunction<void(bool)> onClick
|
2022-09-27 18:15:20 -04:00
|
|
|
) override;
|
|
|
|
|
2022-09-29 08:17:02 -04:00
|
|
|
void onBtn(CCObject*);
|
|
|
|
|
2022-09-27 18:15:20 -04:00
|
|
|
static float estimateHeight(std::string const& content);
|
2022-10-30 14:59:20 -04:00
|
|
|
|
2022-09-27 18:15:20 -04:00
|
|
|
public:
|
|
|
|
static MDPopup* create(
|
2022-10-30 14:59:20 -04:00
|
|
|
std::string const& title, std::string const& content, char const* btn1,
|
2023-02-08 10:25:07 -05:00
|
|
|
char const* btn2 = nullptr, utils::MiniFunction<void(bool)> onClick = nullptr
|
2022-09-27 18:15:20 -04:00
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|