#ifndef RENDEZVOUS_H #define RENDEZVOUS_H #include class ExecEvent; class MainWindow; extern void runOnUiThread(std::function callback); extern void runOnWorkerThread(std::function callback); wxDECLARE_EVENT(UPDATE_STATE_EVENT, wxCommandEvent); template static inline R runOnUiThread(std::function callback) { R retvar; runOnUiThread( [&]() { retvar = callback(); } ); return retvar; } class FluxEngineApp : public wxApp, public wxThreadHelper { public: virtual bool OnInit(); void RunOnWorkerThread(std::function callback); private: void OnExec(const ExecEvent& event); public: bool IsWorkerThreadRunning() const; protected: virtual wxThread::ExitCode Entry(); private: static wxWindow* CreateMainWindow(); void SendUpdateEvent(); private: std::function _callback; wxWindow* _mainWindow; }; wxDECLARE_APP(FluxEngineApp); #define DECLARE_COLOUR(name, red, green, blue) \ static const wxColour name##_COLOUR(red, green, blue); \ static const wxBrush name##_BRUSH(name##_COLOUR); \ static const wxPen name##_PEN(name##_COLOUR) #endif