+#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;
+ break;
+ case wxID_YES:
+ return wxYES;
+ break;
+ case wxID_NO:
+ return wxNO;
+ break;
+ default:
+ case wxID_CANCEL:
+ return wxCANCEL;
+ break;
+ }
+ return ans;
+}
+
+#if wxUSE_TEXTDLG
+wxString wxGetTextFromUser(const wxString& message, const wxString& caption,
+ const wxString& defaultValue, wxWindow *parent,
+ int x, int y, bool WXUNUSED(centre) )
+{
+ wxTextEntryDialog dialog(parent, message, caption, defaultValue, wxOK|wxCANCEL, wxPoint(x, y));
+ if (dialog.ShowModal() == wxID_OK)
+ return dialog.GetValue();
+ else
+ return wxString("");
+}
+#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;
+}
+