Audacity  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ErrorDialog Class Reference

Gives an Error message with an option for help. More...

#include <ErrorDialog.h>

Inheritance diagram for ErrorDialog:
wxDialogWrapper wxTabTraversalWrapper< wxDialog > AliasedFileMissingDialog

Public Member Functions

 ErrorDialog (wxWindow *parent, const wxString &dlogTitle, const wxString &message, const wxString &helpPage, const bool Close=true, const bool modal=true)
 
virtual ~ErrorDialog ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&...args)
 

Private Member Functions

void OnOk (wxCommandEvent &event)
 
void OnHelp (wxCommandEvent &event)
 

Private Attributes

wxString dhelpPage
 
bool dClose
 
bool dModal
 

Detailed Description

Gives an Error message with an option for help.

Definition at line 24 of file ErrorDialog.h.

Constructor & Destructor Documentation

ErrorDialog::ErrorDialog ( wxWindow *  parent,
const wxString &  dlogTitle,
const wxString &  message,
const wxString &  helpPage,
const bool  Close = true,
const bool  modal = true 
)

Definition at line 80 of file ErrorDialog.cpp.

References _(), ShuttleGuiBase::AddFixedText(), ShuttleGui::AddStandardButtons(), dClose, dhelpPage, dModal, eHelpButton, eIsCreating, ShuttleGuiBase::EndVerticalLay(), eOkButton, safenew, ShuttleGuiBase::SetBorder(), and ShuttleGuiBase::StartVerticalLay().

85  :
86  wxDialogWrapper(parent, (wxWindowID)-1, dlogTitle)
87 {
88  SetName(GetTitle());
89 
90  long buttonMask;
91 
92  // only add the help button if we have a URL
93  buttonMask = (helpPage == wxT("")) ? eOkButton : (eHelpButton | eOkButton);
94  dhelpPage = helpPage;
95  dClose = Close;
96  dModal = modal;
97 
98  ShuttleGui S(this, eIsCreating);
99 
100  S.StartVerticalLay();
101  {
102  S.SetBorder( 20 );
103  S.AddFixedText( message );
104  S.SetBorder( 2 );
105  S.AddStandardButtons( buttonMask );
106  }
107  S.EndVerticalLay();
108 
109  Layout();
110  GetSizer()->Fit(this);
111  SetMinSize(GetSize());
112  Center();
113 
114 #if 0
115  // Original non ShuttleGui based code.
116  // Layout did not look good on Windows.
117  wxBoxSizer mainSizer;
118  {
119  auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
120  mainSizer = uMainSizer.get();
121  auto vSizer = make_unique<xBoxSizer>(wxVERTICAL);
122 
123  auto hSizer = make_unique<wxBoxSizer>(wxHORIZONTAL);
124 
125  wxStaticText *statText = safenew wxStaticText(this, -1, message);
126  mainSizer->Add(statText, 0, wxALIGN_LEFT|wxALL, 5);
127 
128  wxButton *help = safenew wxButton(this, wxID_HELP, _("Help"));
129  hSizer->Add(help, 0, wxALIGN_LEFT|wxALL, 5);
130 
131  wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
132  ok->SetDefault();
133  ok->SetFocus();
134  hSizer->Add(ok, 0, wxALIGN_RIGHT|wxALL, 5);
135 
136  vSizer->Add(hSizer.release(), 0, wxALIGN_CENTER|wxALL, 5);
137 
138  mainSizer->Add(vSizer.release(), 0, wxALL, 15 );
139 
140  SetAutoLayout(true);
141  SetSizer(uMainSizer.release());
142  }
143 
144  mainSizer->Fit(this);
145  mainSizer->SetSizeHints(this);
146 #endif
147 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
#define safenew
Definition: Audacity.h:230
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxString dhelpPage
Definition: ErrorDialog.h:37
virtual ErrorDialog::~ErrorDialog ( )
inlinevirtual

Definition at line 34 of file ErrorDialog.h.

34 {}

Member Function Documentation

void ErrorDialog::OnHelp ( wxCommandEvent &  event)
private

Definition at line 158 of file ErrorDialog.cpp.

References dClose, dhelpPage, HelpText(), HelpSystem::ShowHelp(), HelpSystem::ShowHtmlText(), and TitleText().

159 {
160  if( dhelpPage.StartsWith(wxT("innerlink:")) )
161  {
163  this,
164  TitleText(dhelpPage.Mid( 10 ) ),
165  HelpText( dhelpPage.Mid( 10 )),
166  false,
167  true );
168  return;
169  }
171  //OpenInDefaultBrowser( dhelpURL );
172  if(dClose)
173  EndModal(true);
174 }
static void ShowHtmlText(wxWindow *pParent, const wxString &Title, const wxString &HtmlText, bool bIsFile=false, bool bModal=false)
Definition: HelpSystem.cpp:89
wxString HelpText(const wxString &Key)
Definition: HelpText.cpp:298
static void ShowHelp(wxWindow *parent, const wxString &localFileName, const wxString &remoteURL, bool bModal=false, bool alwaysDefaultBrowser=false)
Definition: HelpSystem.cpp:194
wxString TitleText(const wxString &Key)
Definition: HelpText.cpp:139
wxString dhelpPage
Definition: ErrorDialog.h:37
void ErrorDialog::OnOk ( wxCommandEvent &  event)
private

Definition at line 149 of file ErrorDialog.cpp.

References dModal.

150 {
151  if (dModal)
152  EndModal(true);
153  else
154  Destroy();
155 }

Member Data Documentation

bool ErrorDialog::dClose
private

Definition at line 38 of file ErrorDialog.h.

Referenced by ErrorDialog(), and OnHelp().

wxString ErrorDialog::dhelpPage
private

Definition at line 37 of file ErrorDialog.h.

Referenced by ErrorDialog(), and OnHelp().

bool ErrorDialog::dModal
private

Definition at line 39 of file ErrorDialog.h.

Referenced by ErrorDialog(), and OnOk().


The documentation for this class was generated from the following files: