+ {
+ 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
+
+#if wxUSE_COLOURDLG
+
+wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit)
+{
+ wxColourData data;
+ data.SetChooseFull(TRUE);
+ if ( colInit.Ok() )
+ {
+ data.SetColour((wxColour &)colInit); // const_cast
+ }
+
+ wxColour colRet;
+ wxColourDialog dialog(parent, &data);
+ if ( dialog.ShowModal() == wxID_OK )
+ {
+ colRet = dialog.GetColourData().GetColour();
+ }
+ //else: leave it invalid
+
+ return colRet;
+}
+
+#endif // wxUSE_COLOURDLG
+
+#if wxUSE_FONTDLG
+
+wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit)
+{
+ wxFontData data;
+ if ( fontInit.Ok() )
+ {
+ data.SetInitialFont(fontInit);
+ }
+
+ wxFont fontRet;
+ wxFontDialog dialog(parent, data);
+ if ( dialog.ShowModal() == wxID_OK )
+ {
+ fontRet = dialog.GetFontData().GetChosenFont();
+ }
+ //else: leave it invalid
+
+ return fontRet;
+}
+
+#endif // wxUSE_FONTDLG
+// ----------------------------------------------------------------------------
+// missing C RTL functions (FIXME shouldn't be here at all)
+// ----------------------------------------------------------------------------
+
+#if defined( __MWERKS__ ) && !defined(__MACH__)
+char *strdup(const char *s)
+{
+ return strcpy( (char*) malloc( strlen( s ) + 1 ) , s ) ;
+}
+int isascii( int c )
+{
+ return ( c >= 0 && c < 128 ) ;
+}
+#endif // __MWERKS__
+
+// ----------------------------------------------------------------------------
+// wxSafeYield and supporting functions
+// ----------------------------------------------------------------------------
+
+void wxEnableTopLevelWindows(bool enable)
+{
+ wxWindowList::Node *node;
+ for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
+ node->GetData()->Enable(enable);
+}
+
+wxWindowDisabler::wxWindowDisabler(wxWindow *winToSkip)
+{
+ // remember the top level windows which were already disabled, so that we
+ // don't reenable them later
+ m_winDisabled = NULL;
+
+ wxWindowList::Node *node;
+ for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
+ {
+ wxWindow *winTop = node->GetData();
+ if ( winTop == winToSkip )
+ continue;
+
+ if ( winTop->IsEnabled() )
+ {
+ winTop->Disable();
+ }
+ else
+ {
+ if ( !m_winDisabled )
+ {
+ m_winDisabled = new wxWindowList;
+ }
+
+ m_winDisabled->Append(winTop);
+ }
+ }
+}
+
+wxWindowDisabler::~wxWindowDisabler()
+{
+ wxWindowList::Node *node;
+ for ( node = wxTopLevelWindows.GetFirst(); node; node = node->GetNext() )
+ {
+ wxWindow *winTop = node->GetData();
+ if ( !m_winDisabled || !m_winDisabled->Find(winTop) )
+ {
+ winTop->Enable();
+ }
+ //else: had been already disabled, don't reenable
+ }
+
+ delete m_winDisabled;
+}
+
+// Yield to other apps/messages and disable user input to all windows except
+// the given one
+bool wxSafeYield(wxWindow *win, bool onlyIfNeeded)
+{
+ wxWindowDisabler wd(win);
+
+ bool rc;
+ if (onlyIfNeeded)
+ rc = wxYieldIfNeeded();