#include #include #include typedef struct PopupOption { std::string icon, label; //std::function onSelect; // THIS FUCKING API SUCKS bool selected = false; unsigned int id; bool operator!=(const PopupOption& other) const { return label.compare(other.label) != 0; } bool operator==(const PopupOption& other) const { return label.compare(other.label) == 0; } } PopupOption; // primitive for a basic popup menu provided by buttons and combos class Popup { ImVec2 position = ImVec2(8.0f, 8.0f), pivot; std::vector options; bool active = false; static int count; bool setActive(bool active); public: Popup(std::vector options); ~Popup(); void OnRender(); void SetPosition(ImVec2 position, ImVec2 pivot); int CheckSelected(); void Toggle(); static int GetCount(); };