infinipaint/src/GUIStuff/Elements/FontPicker.hpp

29 lines
618 B
C++
Raw Normal View History

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:
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();
2025-11-08 20:50:23 +03:00
bool dropdownOpen = false;
};
}