geode/loader/include/Geode/ui/MDPopup.hpp

34 lines
1,006 B
C++
Raw Normal View History

#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
* for details on what features of MD are supported.
*/
2024-02-10 14:11:59 -05:00
class GEODE_DLL MDPopup :
2022-10-30 14:59:20 -04:00
public Popup<
std::string const&, std::string const&, char const*, char const*,
2024-11-04 12:42:09 -05:00
std::function<void(bool)>> {
protected:
2024-11-04 12:42:09 -05:00
std::function<void(bool)> m_onClick = nullptr;
bool setup(
2022-10-30 14:59:20 -04:00
std::string const& title, std::string const& info, char const* btn1, char const* btn2,
2024-11-04 12:42:09 -05:00
std::function<void(bool)> onClick
) override;
void onBtn(CCObject*);
static float estimateHeight(std::string const& content);
2022-10-30 14:59: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,
2024-11-04 12:42:09 -05:00
char const* btn2 = nullptr, std::function<void(bool)> onClick = nullptr
);
};
}