1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-18 00:50:52 +02:00

Define SimpleMessageBoxException

This commit is contained in:
Paul Licameli 2017-03-24 14:40:39 -04:00
parent d1cbac4181
commit 8e2e4a53b8
2 changed files with 39 additions and 0 deletions

View File

@ -50,6 +50,21 @@ MessageBoxException::~MessageBoxException()
wxAtomicDec( sOutstandingMessages );
}
SimpleMessageBoxException::~SimpleMessageBoxException()
{
}
wxString SimpleMessageBoxException::ErrorMessage() const
{
return message;
}
std::unique_ptr< AudacityException > SimpleMessageBoxException::Move()
{
return std::unique_ptr< AudacityException >
{ safenew SimpleMessageBoxException{ std::move( *this ) } };
}
// This is meant to be invoked via wxEvtHandler::CallAfter
void MessageBoxException::DelayedHandlerAction()
{

View File

@ -69,6 +69,30 @@ private:
mutable bool moved { false };
};
// MessageBoxException that shows a given, unvarying string.
class SimpleMessageBoxException /* not final */ : public MessageBoxException
{
public:
explicit SimpleMessageBoxException( const wxString &message_,
const wxString &caption = wxString{} )
: MessageBoxException{ caption }
, message{ message_ }
{}
~SimpleMessageBoxException() override;
SimpleMessageBoxException( const SimpleMessageBoxException& ) = default;
SimpleMessageBoxException &operator = (
SimpleMessageBoxException && ) PROHIBITED;
std::unique_ptr< AudacityException > Move() override;
// Format a default, internationalized error message for this exception.
virtual wxString ErrorMessage() const override;
private:
wxString message;
};
struct DefaultDelayedHandlerAction
{
void operator () (AudacityException *pException) const