SPH
DelayedCallback.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include <wx/timer.h>
5 
7 
8 class DelayedCallback : private wxTimer {
9 private:
10  Function<void()> callback;
11 
12 public:
13  DelayedCallback() = default;
14 
15  void start(const int milliseconds, Function<void()> newCallback) {
16  callback = newCallback;
17  this->StartOnce(milliseconds);
18  }
19 
20  void stop() {
21  this->Stop();
22  }
23 
24 private:
25  virtual void Notify() override {
26  callback();
27  }
28 };
29 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
Generic wrappers of lambdas, functors and other callables.
#define NAMESPACE_SPH_END
Definition: Object.h:12
void start(const int milliseconds, Function< void()> newCallback)
DelayedCallback()=default