#pragma once #include #include #include #include #include #include #include "RichText/TextBox.hpp" namespace CustomEvents { void init(); extern std::queue eventDataQueue; template bool emit_event(const T& data) { SDL_Event event; SDL_zero(event); event.type = T::EVENT_NUM; if(SDL_PushEvent(&event)) { eventDataQueue.push(data); return true; } return false; } template const T& get_event() { return std::any_cast(eventDataQueue.front()); } void pop_event(); struct PasteEvent { static uint32_t EVENT_NUM; enum class DataType { TEXT, IMAGE } type; std::string data; std::optional richText; std::optional mousePos; }; struct OpenInfiniPaintFileEvent { static uint32_t EVENT_NUM; bool isClient; std::optional filePathSource; std::string netSource; std::string serverLocalID; std::string_view fileDataBuffer; }; struct AddFileToCanvasEvent { static uint32_t EVENT_NUM; enum class Type { BUFFER, PATH } type; std::string name; std::string buffer; std::filesystem::path filePath; Vector2f pos; }; }