diff options
Diffstat (limited to 'library/statusHandler.cpp')
-rw-r--r-- | library/statusHandler.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/library/statusHandler.cpp b/library/statusHandler.cpp new file mode 100644 index 00000000..e19c9904 --- /dev/null +++ b/library/statusHandler.cpp @@ -0,0 +1,28 @@ +#include "statusHandler.h" +#include <wx/app.h> +#include <wx/timer.h> + + +void updateUiNow() +{ + //process UI events and prevent application from "not responding" -> NO performance issue! + wxTheApp->Yield(); + + // while (wxTheApp->Pending()) + // wxTheApp->Dispatch(); +} + + +bool updateUiIsAllowed() +{ + static wxLongLong lastExec = 0; + + wxLongLong newExec = wxGetLocalTimeMillis(); + + if (newExec - lastExec >= UI_UPDATE_INTERVAL) //perform ui updates not more often than necessary + { + lastExec = newExec; + return true; + } + return false; +} |