2011-07-06 16:40:54 +00:00
|
|
|
/*
|
|
|
|
* confirm.cpp
|
|
|
|
* utilities to display some error, warning and info short messges
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2011-09-06 07:02:18 +00:00
|
|
|
#include "wx/wx.h"
|
|
|
|
#include "wx/html/htmlwin.h"
|
|
|
|
#include "html_messagebox.h"
|
2007-12-05 20:54:11 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Display an error or warning message.
|
2011-07-06 16:40:54 +00:00
|
|
|
* TODO:
|
|
|
|
* If display time > 0 the dialog disappears after displayTime ( in 0.1 second )
|
2009-11-23 15:16:50 +00:00
|
|
|
*
|
2007-12-05 20:54:11 +00:00
|
|
|
*/
|
2009-11-23 15:16:50 +00:00
|
|
|
void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-05 20:54:11 +00:00
|
|
|
wxMessageDialog* dialog;
|
|
|
|
|
|
|
|
if( displaytime > 0 )
|
2011-07-06 16:40:54 +00:00
|
|
|
dialog = new wxMessageDialog( parent, text, _( "Warning" ),
|
|
|
|
wxOK | wxCENTRE | wxICON_INFORMATION );
|
2007-12-05 20:54:11 +00:00
|
|
|
else
|
2011-07-06 16:40:54 +00:00
|
|
|
dialog = new wxMessageDialog( parent, text, _( "Error" ),
|
|
|
|
wxOK | wxCENTRE | wxICON_ERROR );
|
2007-12-05 20:54:11 +00:00
|
|
|
|
|
|
|
dialog->ShowModal();
|
|
|
|
dialog->Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-05 20:54:11 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Display an informational message.
|
2011-07-06 16:40:54 +00:00
|
|
|
* TODO:
|
|
|
|
* If display time > 0 the message disappears after displayTime (in 0.1 second )
|
2007-12-05 20:54:11 +00:00
|
|
|
*/
|
2009-11-23 15:16:50 +00:00
|
|
|
void DisplayInfoMessage( wxWindow* parent, const wxString& text,
|
|
|
|
int displaytime )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-05 20:54:11 +00:00
|
|
|
wxMessageDialog* dialog;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-07-06 16:40:54 +00:00
|
|
|
dialog = new wxMessageDialog( parent, text, _( "Info:" ),
|
|
|
|
wxOK | wxCENTRE | wxICON_INFORMATION );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-06 18:54:57 +00:00
|
|
|
dialog->ShowModal();
|
|
|
|
dialog->Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-06 07:02:18 +00:00
|
|
|
/* Display a simple message window in html format.
|
|
|
|
*/
|
|
|
|
void DisplayHtmlInfoMessage( wxWindow* parent, const wxString& title,
|
|
|
|
const wxString& text, const wxSize& size )
|
|
|
|
{
|
|
|
|
HTML_MESSAGE_BOX *dlg = new HTML_MESSAGE_BOX(parent,title, wxDefaultPosition, size );
|
|
|
|
dlg->AddHTML_Text( text );
|
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-05 20:54:11 +00:00
|
|
|
bool IsOK( wxWindow* parent, const wxString& text )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-05 20:54:11 +00:00
|
|
|
int ii;
|
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
ii = wxMessageBox( text, _( "Confirmation" ),
|
|
|
|
wxYES_NO | wxCENTRE | wxICON_HAND, parent );
|
2007-12-05 20:54:11 +00:00
|
|
|
if( ii == wxYES )
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|