Audacity  2.2.2
ErrorDialog.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  ErrorDialog.h
6 
7  Jimmy Johnson
8  James Crook
9 
10 **********************************************************************/
11 
12 #ifndef __AUDACITY_ERRORDIALOG__
13 #define __AUDACITY_ERRORDIALOG__
14 
15 #include "../Audacity.h"
16 #include <wx/defs.h>
17 #include <wx/msgdlg.h>
18 #include <wx/window.h>
19 #include "LinkingHtmlWindow.h"
20 #include "wxPanelWrapper.h"
21 
22 class AudacityProject;
23 
24 class ErrorDialog /* not final */ : public wxDialogWrapper
25 {
26 public:
27  // constructors and destructors
28  ErrorDialog(wxWindow *parent,
29  const wxString & dlogTitle,
30  const wxString & message,
31  const wxString & helpPage,
32  const bool Close = true, const bool modal = true);
33 
34  virtual ~ErrorDialog(){}
35 
36 private:
37  wxString dhelpPage;
38  bool dClose;
39  bool dModal;
40 
41  void OnOk( wxCommandEvent &event );
42  void OnHelp( wxCommandEvent &event );
43  DECLARE_EVENT_TABLE()
44 };
45 
46 // Helper class to make browser "simulate" a modal dialog
47 class HtmlTextHelpDialog final : public BrowserDialog
48 {
49 public:
50  HtmlTextHelpDialog(wxWindow *pParent, const wxString &title)
51  : BrowserDialog{ pParent, title }
52  {
53 #if !wxCHECK_VERSION(3, 0, 0)
54  MakeModal( true );
55 #endif
56  }
58  {
59 #if !wxCHECK_VERSION(3, 0, 0)
60  MakeModal( false );
61 #endif
62  // On Windows, for some odd reason, the Audacity window will be sent to
63  // the back. So, make sure that doesn't happen.
64  GetParent()->Raise();
65  }
66 };
67 
69 void ShowErrorDialog(wxWindow *parent,
70  const wxString &dlogTitle,
71  const wxString &message,
72  const wxString &helpPage,
73  bool Close = true);
74 
76 void ShowModelessErrorDialog(wxWindow *parent,
77  const wxString &dlogTitle,
78  const wxString &message,
79  const wxString &helpPage,
80  bool Close = true);
81 
84  const wxString &dlogTitle,
85  const wxString &message,
86  const wxString &helpPage,
87  const bool Close = true);
88 
89 extern wxString AudacityMessageBoxCaptionStr();
90 
91 // Do not use wxMessageBox!! Its default window title does not translate!
92 inline int AudacityMessageBox(const wxString& message,
93  const wxString& caption = AudacityMessageBoxCaptionStr(),
94  long style = wxOK | wxCENTRE,
95  wxWindow *parent = NULL,
96  int x = wxDefaultCoord, int y = wxDefaultCoord)
97 {
98  return ::wxMessageBox(message, caption, style, parent, x, y);
99 }
100 
101 
102 #include <wx/textdlg.h>
103 
104 /**************************************************************************/
108 class AudacityTextEntryDialog : public wxTabTraversalWrapper< wxTextEntryDialog >
109 {
110 public:
112  wxWindow *parent,
113  const wxString& message,
114  const wxString& caption, // don't use = wxGetTextFromUserPromptStr,
115  const wxString& value = wxEmptyString,
116  long style = wxTextEntryDialogStyle,
117  const wxPoint& pos = wxDefaultPosition)
118  : wxTabTraversalWrapper< wxTextEntryDialog>
119  ( parent, message, caption, value, style, pos )
120  {}
121 
122  void SetInsertionPointEnd();
123 };
124 
125 /**************************************************************************/
129 class AudacityMessageDialog : public wxTabTraversalWrapper< wxMessageDialog >
130 {
131 public:
133  wxWindow *parent,
134  const wxString& message,
135  const wxString& caption, // don't use = wxMessageBoxCaptionStr,
136  long style = wxOK|wxCENTRE,
137  const wxPoint& pos = wxDefaultPosition)
138  : wxTabTraversalWrapper< wxMessageDialog>
139  ( parent, message, caption, style, pos )
140  {}
141 };
142 
143 #endif // __AUDACITY_ERRORDIALOG__
virtual ~ErrorDialog()
Definition: ErrorDialog.h:34
virtual ~HtmlTextHelpDialog()
Definition: ErrorDialog.h:57
void ShowErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, const wxString &helpPage, bool Close=true)
Displays an error dialog with a button that offers help.
void OnOk(wxCommandEvent &event)
void OnHelp(wxCommandEvent &event)
int AudacityMessageBox(const wxString &message, const wxString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: ErrorDialog.h:92
void ShowAliasMissingDialog(AudacityProject *parent, const wxString &dlogTitle, const wxString &message, const wxString &helpPage, const bool Close=true)
Displays a custom modeless error dialog for aliased file errors.
Wrap wxTextEntryDialog so that caption IS translatable.
Definition: ErrorDialog.h:108
Wrap wxMessageDialog so that caption IS translatable.
Definition: ErrorDialog.h:129
AudacityMessageDialog(wxWindow *parent, const wxString &message, const wxString &caption, long style=wxOK|wxCENTRE, const wxPoint &pos=wxDefaultPosition)
Definition: ErrorDialog.h:132
ErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, const wxString &helpPage, const bool Close=true, const bool modal=true)
Definition: ErrorDialog.cpp:80
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
HtmlTextHelpDialog(wxWindow *pParent, const wxString &title)
Definition: ErrorDialog.h:50
void SetInsertionPointEnd()
AudacityTextEntryDialog(wxWindow *parent, const wxString &message, const wxString &caption, const wxString &value=wxEmptyString, long style=wxTextEntryDialogStyle, const wxPoint &pos=wxDefaultPosition)
Definition: ErrorDialog.h:111
wxString AudacityMessageBoxCaptionStr()
void ShowModelessErrorDialog(wxWindow *parent, const wxString &dlogTitle, const wxString &message, const wxString &helpPage, bool Close=true)
Displays a modeless error dialog with a button that offers help.
Gives an Error message with an option for help.
Definition: ErrorDialog.h:24
wxString dhelpPage
Definition: ErrorDialog.h:37