//----------------------------------------------------------------------------- // The GTK-based implementation of platform-dependent GUI functionality. // // Copyright 2018 whitequark //----------------------------------------------------------------------------- #include #include "solvespace.h" namespace SolveSpace { namespace Platform { //----------------------------------------------------------------------------- // Timers //----------------------------------------------------------------------------- class TimerImplGtk : public Timer { public: sigc::connection _connection; void WindUp(unsigned milliseconds) override { if(!_connection.empty()) { _connection.disconnect(); } auto handler = [this]() { if(this->onTimeout) { this->onTimeout(); } return false; }; _connection = Glib::signal_timeout().connect(handler, milliseconds); } }; TimerRef CreateTimer() { return std::unique_ptr(new TimerImplGtk); } } }