-#endif // wxUSE_GUI/!wxUSE_GUI
-#endif // __WXMICROWIN__
-
-// ----------------------------------------------------------------------------
-// deprecated (in favour of wxLog) log functions
-// ----------------------------------------------------------------------------
-
-#if wxUSE_GUI
-
-// Output a debug mess., in a system dependent fashion.
-#ifndef __WXMICROWIN__
-void wxDebugMsg(const wxChar *fmt ...)
-{
- va_list ap;
- static wxChar buffer[512];
-
- if (!wxTheApp->GetWantDebugOutput())
- return ;
-
- va_start(ap, fmt);
-
- wvsprintf(buffer,fmt,ap) ;
- OutputDebugString((LPCTSTR)buffer) ;
-
- va_end(ap);
-}
-
-// Non-fatal error: pop up message box and (possibly) continue
-void wxError(const wxString& msg, const wxString& title)
-{
- wxSprintf(wxBuffer, wxT("%s\nContinue?"), WXSTRINGCAST msg);
- if (MessageBox(NULL, (LPCTSTR)wxBuffer, (LPCTSTR)WXSTRINGCAST title,
- MB_ICONSTOP | MB_YESNO) == IDNO)
- wxExit();
-}
-
-// Fatal error: pop up message box and abort
-void wxFatalError(const wxString& msg, const wxString& title)
-{
- wxSprintf(wxBuffer, wxT("%s: %s"), WXSTRINGCAST title, WXSTRINGCAST msg);
- FatalAppExit(0, (LPCTSTR)wxBuffer);
-}
-#endif // __WXMICROWIN__
-
-// ----------------------------------------------------------------------------
-// functions to work with .INI files
-// ----------------------------------------------------------------------------
-
-// Reading and writing resources (eg WIN.INI, .Xdefaults)
-#if wxUSE_RESOURCES
-bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
-{
- if (file != wxT(""))
-// Don't know what the correct cast should be, but it doesn't
-// compile in BC++/16-bit without this cast.
-#if !defined(__WIN32__)
- return (WritePrivateProfileString((const char*) section, (const char*) entry, (const char*) value, (const char*) file) != 0);
-#else
- return (WritePrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)value, (LPCTSTR)WXSTRINGCAST file) != 0);
-#endif
- else
- return (WriteProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)WXSTRINGCAST value) != 0);
-}
-
-bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
-{
- wxString buf;
- buf.Printf(wxT("%.4f"), value);
-
- return wxWriteResource(section, entry, buf, file);
-}
-
-bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
-{
- wxString buf;
- buf.Printf(wxT("%ld"), value);
-
- return wxWriteResource(section, entry, buf, file);
-}
-
-bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
-{
- wxString buf;
- buf.Printf(wxT("%d"), value);
-
- return wxWriteResource(section, entry, buf, file);
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file)
-{
- static const wxChar defunkt[] = wxT("$$default");
- if (file != wxT(""))
- {
- int n = GetPrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
- (LPTSTR)wxBuffer, 1000, (LPCTSTR)WXSTRINGCAST file);
- if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
- return FALSE;
- }
- else
- {
- int n = GetProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
- (LPTSTR)wxBuffer, 1000);
- if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
- return FALSE;
- }
- if (*value) delete[] (*value);
- *value = copystring(wxBuffer);
- return TRUE;
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
-{
- wxChar *s = NULL;
- bool succ = wxGetResource(section, entry, (wxChar **)&s, file);
- if (succ)
- {
- *value = (float)wxStrtod(s, NULL);
- delete[] s;
- return TRUE;
- }
- else return FALSE;
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
-{
- wxChar *s = NULL;
- bool succ = wxGetResource(section, entry, (wxChar **)&s, file);
- if (succ)
- {
- *value = wxStrtol(s, NULL, 10);
- delete[] s;
- return TRUE;
- }
- else return FALSE;
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
-{
- wxChar *s = NULL;
- bool succ = wxGetResource(section, entry, (wxChar **)&s, file);
- if (succ)
- {
- *value = (int)wxStrtol(s, NULL, 10);
- delete[] s;
- return TRUE;
- }
- else return FALSE;
-}
-#endif // wxUSE_RESOURCES
-
-// ---------------------------------------------------------------------------
-// helper functions for showing a "busy" cursor
-// ---------------------------------------------------------------------------
-
-static HCURSOR gs_wxBusyCursor = 0; // new, busy cursor
-static HCURSOR gs_wxBusyCursorOld = 0; // old cursor
-static int gs_wxBusyCursorCount = 0;
-
-extern HCURSOR wxGetCurrentBusyCursor()
-{
- return gs_wxBusyCursor;
-}
-
-// Set the cursor to the busy cursor for all windows
-void wxBeginBusyCursor(wxCursor *cursor)
-{
- if ( gs_wxBusyCursorCount++ == 0 )
- {
- gs_wxBusyCursor = (HCURSOR)cursor->GetHCURSOR();
-#ifndef __WXMICROWIN__
- gs_wxBusyCursorOld = ::SetCursor(gs_wxBusyCursor);
-#endif
- }
- //else: nothing to do, already set
-}
-
-// Restore cursor to normal
-void wxEndBusyCursor()
-{
- wxCHECK_RET( gs_wxBusyCursorCount > 0,
- wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
-
- if ( --gs_wxBusyCursorCount == 0 )
- {
-#ifndef __WXMICROWIN__
- ::SetCursor(gs_wxBusyCursorOld);
-#endif
- gs_wxBusyCursorOld = 0;
- }
-}
-
-// TRUE if we're between the above two calls
-bool wxIsBusy()
-{
- return gs_wxBusyCursorCount > 0;
-}
-
-// Check whether this window wants to process messages, e.g. Stop button
-// in long calculations.
-bool wxCheckForInterrupt(wxWindow *wnd)
-{
- wxCHECK( wnd, FALSE );
-
- MSG msg;
- while ( ::PeekMessage(&msg, GetHwndOf(wnd), 0, 0, PM_REMOVE) )
- {
- ::TranslateMessage(&msg);
- ::DispatchMessage(&msg);
- }
-
- return TRUE;
-}
-
-// MSW only: get user-defined resource from the .res file.
-// Returns NULL or newly-allocated memory, so use delete[] to clean up.
-
-#ifndef __WXMICROWIN__
-wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType)
-{
- HRSRC hResource = ::FindResource(wxGetInstance(), resourceName, resourceType);
- if ( hResource == 0 )
- return NULL;
-
- HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
- if ( hData == 0 )
- return NULL;
-
- wxChar *theText = (wxChar *)::LockResource(hData);
- if ( !theText )
- return NULL;
-
- // Not all compilers put a zero at the end of the resource (e.g. BC++ doesn't).
- // so we need to find the length of the resource.
- int len = ::SizeofResource(wxGetInstance(), hResource);
- wxChar *s = new wxChar[len+1];
- wxStrncpy(s,theText,len);
- s[len]=0;
-
- // wxChar *s = copystring(theText);
-
- // Obsolete in WIN32
-#ifndef __WIN32__
- UnlockResource(hData);
-#endif
-
- // No need??
- // GlobalFree(hData);
-
- return s;
-}
-#endif // __WXMICROWIN__
-