Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5231: Convert call to askForSave() to a veto-able ApplicationShutdow…
…nRequest sent over the message bus
- Loading branch information
1 parent
6ec1bd3
commit f394ef1
Showing
5 changed files
with
71 additions
and
19 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
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,41 @@ | ||
#pragma once | ||
|
||
#include "imessagebus.h" | ||
|
||
namespace radiant | ||
{ | ||
|
||
/** | ||
* Message that is broadcast when the user requests to close | ||
* the application. Subscribes can deny() the request to prevent | ||
* the loss of unsaved data or similar. | ||
*/ | ||
class ApplicationShutdownRequest : | ||
public radiant::IMessage | ||
{ | ||
private: | ||
bool _denied; | ||
|
||
public: | ||
ApplicationShutdownRequest() | ||
{} | ||
|
||
std::size_t getId() const override | ||
{ | ||
return Type::ApplicationShutdownRequest; | ||
} | ||
|
||
// Deny this request to keep the app running | ||
void deny() | ||
{ | ||
_denied = true; | ||
} | ||
|
||
// TRUE whether this request has been denied and the app should stay alive | ||
bool isDenied() const | ||
{ | ||
return _denied; | ||
} | ||
}; | ||
|
||
} |
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