- return wxWINDOWS; // error if we get here, return generic value
-}
-
-// Reading and writing resources (eg WIN.INI, .Xdefaults)
-#if wxUSE_RESOURCES
-bool wxWriteResource(
- const wxString& rSection
-, const wxString& rEntry
-, const wxString& rValue
-, const wxString& rFile
-)
-{
- HAB hab = 0;
- HINI hIni = 0;
-
- if (rFile != "")
- {
- hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile);
- if (hIni != 0L)
- {
- return (::PrfWriteProfileString( hIni
- ,(PSZ)WXSTRINGCAST rSection
- ,(PSZ)WXSTRINGCAST rEntry
- ,(PSZ)WXSTRINGCAST rValue
- ));
- }
- }
- else
- return (::PrfWriteProfileString( HINI_PROFILE
- ,(PSZ)WXSTRINGCAST rSection
- ,(PSZ)WXSTRINGCAST rEntry
- ,(PSZ)WXSTRINGCAST rValue
- ));
- return FALSE;
-}
-
-bool wxWriteResource(
- const wxString& rSection
-, const wxString& rEntry
-, float fValue
-, const wxString& rFile
-)
-{
- wxChar zBuf[50];
-
- wxSprintf(zBuf, "%.4f", fValue);
- return wxWriteResource( rSection
- ,rEntry
- ,zBuf
- ,rFile
- );
-}
-
-bool wxWriteResource(
- const wxString& rSection
-, const wxString& rEntry
-, long lValue
-, const wxString& rFile
-)
-{
- wxChar zBuf[50];
-
- wxSprintf(zBuf, "%ld", lValue);
- return wxWriteResource( rSection
- ,rEntry
- ,zBuf
- ,rFile
- );
-}
-
-bool wxWriteResource(
- const wxString& rSection
-, const wxString& rEntry
-, int lValue
-, const wxString& rFile
-)
-{
- wxChar zBuf[50];
-
- wxSprintf(zBuf, "%d", lValue);
- return wxWriteResource( rSection
- ,rEntry
- ,zBuf
- ,rFile
- );
-}
-
-bool wxGetResource(
- const wxString& rSection
-, const wxString& rEntry
-, wxChar** ppValue
-, const wxString& rFile
-)
-{
- HAB hab = 0;
- HINI hIni = 0;
- wxChar zDefunkt[] = _T("$$default");
- char zBuf[1000];
-
- if (rFile != "")
- {
- hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile);
- if (hIni != 0L)
- {
- ULONG n = ::PrfQueryProfileString( hIni
- ,(PSZ)WXSTRINGCAST rSection
- ,(PSZ)WXSTRINGCAST rEntry
- ,(PSZ)zDefunkt
- ,(PVOID)zBuf
- ,1000
- );
- if (zBuf == NULL)
- return FALSE;
- if (n == 0L || wxStrcmp(zBuf, zDefunkt) == 0)
- return FALSE;
- zBuf[n-1] = '\0';
- }
- else
- return FALSE;
- }
- else
- {
- ULONG n = ::PrfQueryProfileString( HINI_PROFILE
- ,(PSZ)WXSTRINGCAST rSection
- ,(PSZ)WXSTRINGCAST rEntry
- ,(PSZ)zDefunkt
- ,(PVOID)zBuf
- ,1000
- );
- if (zBuf == NULL)
- return FALSE;
- if (n == 0L || wxStrcmp(zBuf, zDefunkt) == 0)
- return FALSE;
- zBuf[n-1] = '\0';
- }
- strcpy((char*)*ppValue, zBuf);
- return TRUE;
-}
-
-bool wxGetResource(
- const wxString& rSection
-, const wxString& rEntry
-, float* pValue
-, const wxString& rFile
-)
-{
- wxChar* zStr = NULL;
-
- zStr = new wxChar[1000];
- bool bSucc = wxGetResource( rSection
- ,rEntry
- ,(wxChar **)&zStr
- ,rFile
- );
-
- if (bSucc)
- {
- *pValue = (float)wxStrtod(zStr, NULL);
- delete[] zStr;
- return TRUE;
- }
- else
- {
- delete[] zStr;
- return FALSE;
- }
-}
-
-bool wxGetResource(
- const wxString& rSection
-, const wxString& rEntry
-, long* pValue
-, const wxString& rFile
-)
-{
- wxChar* zStr = NULL;
-
- zStr = new wxChar[1000];
- bool bSucc = wxGetResource( rSection
- ,rEntry
- ,(wxChar **)&zStr
- ,rFile
- );
-
- if (bSucc)
- {
- *pValue = wxStrtol(zStr, NULL, 10);
- delete[] zStr;
- return TRUE;
- }
- else
- {
- delete[] zStr;
- return FALSE;
- }
-}
-
-bool wxGetResource(
- const wxString& rSection
-, const wxString& rEntry
-, int* pValue
-, const wxString& rFile
-)
-{
- wxChar* zStr = NULL;
-
- zStr = new wxChar[1000];
- bool bSucc = wxGetResource( rSection
- ,rEntry
- ,(wxChar **)&zStr
- ,rFile
- );
-
- if (bSucc)
- {
- *pValue = (int)wxStrtol(zStr, NULL, 10);
- delete[] zStr;
- return TRUE;
- }
- else
- {
- delete[] zStr;
- return FALSE;
- }
-}
-#endif // wxUSE_RESOURCES
-
-// ---------------------------------------------------------------------------
-// helper functions for showing a "busy" cursor
-// ---------------------------------------------------------------------------
-
-HCURSOR gs_wxBusyCursor = 0; // new, busy cursor
-HCURSOR gs_wxBusyCursorOld = 0; // old cursor
-static int gs_wxBusyCursorCount = 0;
-
-// Set the cursor to the busy cursor for all windows
-void wxBeginBusyCursor(
- wxCursor* pCursor
-)
-{
- if ( gs_wxBusyCursorCount++ == 0 )
- {
- gs_wxBusyCursor = (HCURSOR)pCursor->GetHCURSOR();
- ::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursor);
- }
- //else: nothing to do, already set
-}
-
-// Restore cursor to normal
-void wxEndBusyCursor()
-{
- wxCHECK_RET( gs_wxBusyCursorCount > 0
- ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
- );
-
- if (--gs_wxBusyCursorCount == 0)
- {
- ::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursorOld);
- gs_wxBusyCursorOld = 0;
- }
-}
-
-// TRUE if we're between the above two calls
-bool wxIsBusy()
-{
- return (gs_wxBusyCursorCount > 0);