+#if wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// GUI helpers
+// ----------------------------------------------------------------------------
+
+/*
+ * N.B. these convenience functions must be separate from msgdlgg.cpp, textdlgg.cpp
+ * since otherwise the generic code may be pulled in unnecessarily.
+ */
+
+int wxMessageBox(const wxString& message, const wxString& caption, long style,
+ wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) )
+{
+ wxMessageDialog dialog(parent, message, caption, style);
+
+ int ans = dialog.ShowModal();
+ switch ( ans )
+ {
+ case wxID_OK:
+ return wxOK;
+ case wxID_YES:
+ return wxYES;
+ case wxID_NO:
+ return wxNO;
+ default:
+ case wxID_CANCEL:
+ return wxCANCEL;
+ }
+}
+
+#if wxUSE_TEXTDLG
+wxString wxGetTextFromUser(const wxString& message, const wxString& caption,
+ const wxString& defaultValue, wxWindow *parent,
+ int x, int y, bool WXUNUSED(centre) )
+{
+ wxString str;
+ wxTextEntryDialog dialog(parent, message, caption, defaultValue, wxOK|wxCANCEL, wxPoint(x, y));
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ str = dialog.GetValue();
+ }
+
+ return str;
+}
+
+wxString wxGetPasswordFromUser(const wxString& message,
+ const wxString& caption,
+ const wxString& defaultValue,
+ wxWindow *parent)
+{
+ wxString str;
+ wxTextEntryDialog dialog(parent, message, caption, defaultValue,
+ wxOK | wxCANCEL | wxTE_PASSWORD);
+ if ( dialog.ShowModal() == wxID_OK )
+ {
+ str = dialog.GetValue();
+ }
+
+ return str;
+}
+
+#endif // wxUSE_TEXTDLG
+
+#ifdef __MWERKS__
+char *strdup(const char *s)
+{
+ return strcpy( (char*) malloc( strlen( s ) + 1 ) , s ) ;
+}
+
+int isascii( int c )
+{
+ return ( c >= 0 && c < 128 ) ;
+}
+#endif // __MWERKS__
+
+// ----------------------------------------------------------------------------
+// misc functions
+// ----------------------------------------------------------------------------
+
+void wxEnableTopLevelWindows(bool enable)
+{
+ wxWindowList::Node *node;
+ for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
+ node->GetData()->Enable(enable);
+}
+
+// Yield to other apps/messages and disable user input
+bool wxSafeYield(wxWindow *win)
+{
+ wxEnableTopLevelWindows(FALSE);
+ // always enable ourselves
+ if ( win )
+ win->Enable(TRUE);
+ bool rc = wxYield();
+ wxEnableTopLevelWindows(TRUE);
+ return rc;
+}
+
+// Don't synthesize KeyUp events holding down a key and producing KeyDown
+// events with autorepeat. On by default and always on in wxMSW. wxGTK version
+// in utilsgtk.cpp.
+#ifndef __WXGTK__
+bool wxSetDetectableAutoRepeat( bool WXUNUSED(flag) )
+{
+ return TRUE; // detectable auto-repeat is the only mode MSW supports
+}
+#endif // !wxGTK
+
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// network and user id functions
+// ----------------------------------------------------------------------------
+
+// Get Full RFC822 style email address
+bool wxGetEmailAddress(wxChar *address, int maxSize)
+{
+ wxString email = wxGetEmailAddress();
+ if ( !email )
+ return FALSE;
+
+ wxStrncpy(address, email, maxSize - 1);
+ address[maxSize - 1] = wxT('\0');
+
+ return TRUE;
+}
+
+wxString wxGetEmailAddress()
+{
+ wxString email;
+
+ wxString host = wxGetHostName();
+ if ( !!host )
+ {
+ wxString user = wxGetUserId();
+ if ( !!user )
+ {
+ wxString email(user);
+ email << wxT('@') << host;
+ }
+ }
+
+ return email;
+}
+
+wxString wxGetUserId()
+{
+ static const int maxLoginLen = 256; // FIXME arbitrary number
+
+ wxString buf;
+ bool ok = wxGetUserId(buf.GetWriteBuf(maxLoginLen), maxLoginLen);
+ buf.UngetWriteBuf();
+
+ if ( !ok )
+ buf.Empty();
+
+ return buf;
+}
+
+wxString wxGetUserName()
+{
+ static const int maxUserNameLen = 1024; // FIXME arbitrary number
+
+ wxString buf;
+ bool ok = wxGetUserName(buf.GetWriteBuf(maxUserNameLen), maxUserNameLen);
+ buf.UngetWriteBuf();
+
+ if ( !ok )
+ buf.Empty();
+
+ return buf;
+}
+
+wxString wxGetHostName()
+{
+ static const size_t hostnameSize = 257;
+
+ wxString buf;
+ bool ok = wxGetHostName(buf.GetWriteBuf(hostnameSize), hostnameSize);
+
+ buf.UngetWriteBuf();
+
+ if ( !ok )
+ buf.Empty();
+
+ return buf;
+}
+
+wxString wxGetFullHostName()
+{
+ static const size_t hostnameSize = 257;
+
+ wxString buf;
+ bool ok = wxGetFullHostName(buf.GetWriteBuf(hostnameSize), hostnameSize);
+
+ buf.UngetWriteBuf();
+
+ if ( !ok )
+ buf.Empty();
+
+ return buf;
+}
+
+wxString wxGetHomeDir()
+{
+ wxString home;
+ wxGetHomeDir(&home);
+
+ return home;
+}
+
+#if 0
+
+wxString wxGetCurrentDir()
+{
+ wxString dir;
+ size_t len = 1024;
+ bool ok;
+ do
+ {
+ ok = getcwd(dir.GetWriteBuf(len + 1), len) != NULL;
+ dir.UngetWriteBuf();
+
+ if ( !ok )
+ {
+ if ( errno != ERANGE )
+ {
+ wxLogSysError(_T("Failed to get current directory"));
+
+ return wxEmptyString;
+ }
+ else
+ {
+ // buffer was too small, retry with a larger one
+ len *= 2;
+ }
+ }
+ //else: ok
+ } while ( !ok );
+
+ return dir;
+}
+
+#endif // 0