MeshLib
 
Loading...
Searching...
No Matches
MRViewerEventQueue.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRViewerFwd.h"
4#include "MRMesh/MRMeshFwd.h"
5#include <mutex>
6#include <queue>
7#include <string>
8
9namespace MR
10{
11
13class MRVIEWER_CLASS ViewerEventQueue
14{
15public:
16 // emplace event at the end of the queue
17 // replace last skipable with new skipable
18 MRVIEWER_API void emplace( std::string name, ViewerEventCallback cb, bool skipable = false );
19 // execute all events in queue
20 MRVIEWER_API void execute();
21 // pop all events while they have this name
22 MRVIEWER_API void popByName( const std::string& name );
23 MRVIEWER_API bool empty() const;
24
25private:
26 struct NamedEvent
27 {
28 std::string name;
30 };
31 // important for wasm to be recursive
32 mutable std::recursive_mutex mutex_;
33 std::queue<NamedEvent> queue_;
34 bool lastSkipable_{false};
35};
36
37} //namespace MR
queue to ignore multiple mouse moves in one frame
Definition MRViewerEventQueue.h:14
MRVIEWER_API bool empty() const
MRVIEWER_API void emplace(std::string name, ViewerEventCallback cb, bool skipable=false)
MRVIEWER_API void execute()
MRVIEWER_API void popByName(const std::string &name)
Definition MRCameraOrientationPlugin.h:7
std::function< void()> ViewerEventCallback
Definition MRViewerFwd.h:64