2025-11-08 20:50:23 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include "Element.hpp"
|
2026-04-05 11:02:48 +03:00
|
|
|
#include <limits>
|
2025-11-08 20:50:23 +03:00
|
|
|
|
|
|
|
|
namespace GUIStuff {
|
|
|
|
|
|
2026-04-05 11:02:48 +03:00
|
|
|
struct FontPickerData {
|
|
|
|
|
std::function<void()> onFontChange;
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-08 20:50:23 +03:00
|
|
|
class FontPicker : public Element {
|
|
|
|
|
public:
|
2026-03-27 09:51:53 +03:00
|
|
|
FontPicker(GUIManager& gui);
|
2026-04-05 11:02:48 +03:00
|
|
|
void layout(const Clay_ElementId& id, std::string* newFontName, const FontPickerData& newData = {});
|
2025-11-08 20:50:23 +03:00
|
|
|
private:
|
2026-04-05 11:02:48 +03:00
|
|
|
std::string* fontName;
|
|
|
|
|
FontPickerData data;
|
|
|
|
|
|
|
|
|
|
size_t hoveringOver = std::numeric_limits<size_t>::max();
|
|
|
|
|
|
|
|
|
|
bool jumpToFontName = false;
|
|
|
|
|
|
|
|
|
|
std::optional<std::string> get_valid_font_name();
|
2026-03-27 09:51:53 +03:00
|
|
|
|
2025-11-08 20:50:23 +03:00
|
|
|
bool dropdownOpen = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|