Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5662: Extract UserInterfaceModule to allow plugins to dispatch code …
…to the UI thread
- Loading branch information
1 parent
5c746b5
commit ef045b7
Showing
6 changed files
with
54 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "imodule.h" | ||
|
||
namespace ui | ||
{ | ||
|
||
class IUserInterfaceModule : | ||
public RegisterableModule | ||
{ | ||
public: | ||
virtual ~IUserInterfaceModule() {} | ||
|
||
// Runs the specified action in the UI thread | ||
// this happens when the application has a chance to, usually during event processing | ||
// This method is safe to be called from any thread. | ||
virtual void dispatch(const std::function<void()>& action) = 0; | ||
}; | ||
|
||
} | ||
|
||
constexpr const char* const MODULE_USERINTERFACE = "UserInterfaceModule"; | ||
|
||
// The accessor function | ||
inline ui::IUserInterfaceModule& GlobalUserInterface() | ||
{ | ||
static module::InstanceReference<ui::IUserInterfaceModule> _reference(MODULE_USERINTERFACE); | ||
return _reference; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters