From 1827f1ab9bf44490cf24779e0eab8533845b4a77 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 29 Jun 2013 21:46:10 +0200 Subject: New inter-thread message system. --- src/message.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/message.h') diff --git a/src/message.h b/src/message.h index 4ce65ef..d51c263 100644 --- a/src/message.h +++ b/src/message.h @@ -27,6 +27,10 @@ #ifndef __DRUMGIZMO_MESSAGE_H__ #define __DRUMGIZMO_MESSAGE_H__ +#include + +class MessageHandler; + class Message { public: typedef enum { @@ -39,15 +43,24 @@ public: LoadMidimap, // Signal engine to load midimap. EngineSettingsMessage, // Request or receive engine settings. ChangeSettingMessage, // Update named setting in engine. + RegisterUIMessage, // Register new UI message handler } type_t; + typedef enum { + NormalProcessing, // Just add to the queue + FilterMultiple, // Ignore top message if it has the same type. + // SyncWait, // Block the send call until the message has been handled by the receiver. + } processing_mode_t; + virtual ~Message() {} virtual type_t type() = 0; + virtual processing_mode_t processing_mode() { return NormalProcessing; } }; class LoadStatusMessage : public Message { public: type_t type() { return Message::LoadStatus; } + processing_mode_t processing_mode() { return FilterMultiple; } unsigned int number_of_files; unsigned int numer_of_files_loaded; std::string current_file; @@ -106,4 +119,10 @@ public: float value; }; +class RegisterUIMessage : public Message { +public: + type_t type() { return Message::RegisterUIMessage; } + MessageHandler *messagehandler; +}; + #endif/*__DRUMGIZMO_MESSAGE_H__*/ -- cgit v1.2.3