]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/utilsgui.cpp
Try to better revert to the original string value in wxBitmapComboBox::RecreateControl()
[wxWidgets.git] / src / os2 / utilsgui.cpp
index a3779dee7fba36aaa817b34f12291058bdb546f0..9ab06acf96f586e6413bc060a003c7dd6d503613 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     20.08.2003 (extracted from os2/utils.cpp)
 // RCS-ID:      $Id$
 // Copyright:   (c) David Webster
-// License:     wxWindows licence
+// Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
     #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/cursor.h"
+    #include "wx/font.h"
     #include "wx/timer.h"
 #endif //WX_PRECOMP
 
 #include "wx/apptrait.h"
+#include "wx/os2/private/timer.h"
+#include "wx/evtloop.h"
 
 #include "wx/os2/private.h"     // includes <windows.h>
 
@@ -56,190 +59,6 @@ public:
     }
 };
 
-// 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.empty())
-    {
-        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.empty())
-    {
-        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 bSucc;
-}
-
-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 bSucc;
-}
-
-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 bSucc;
-}
-#endif // wxUSE_RESOURCES
-
 // ---------------------------------------------------------------------------
 // helper functions for showing a "busy" cursor
 // ---------------------------------------------------------------------------
@@ -263,7 +82,7 @@ void wxBeginBusyCursor(const wxCursor* pCursor)
 void wxEndBusyCursor()
 {
     wxCHECK_RET( gs_wxBusyCursorCount > 0
-                ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
+                ,wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
                );
 
     if (--gs_wxBusyCursorCount == 0)
@@ -297,7 +116,7 @@ bool wxCheckForInterrupt( wxWindow* pWnd )
     }
     else
     {
-        wxFAIL_MSG(_T("pWnd==NULL !!!"));
+        wxFAIL_MSG(wxT("pWnd==NULL !!!"));
         return false;//*** temporary?
     }
 }
@@ -439,10 +258,20 @@ void wxGUIAppTraits::TerminateGui(unsigned long ulHab)
 
 wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const
 {
-    // TODO: how to get version of PM ?
+    // How to get version of PM ? I guess, just reusing the OS version is OK.
+    (void) wxGetOsVersion(verMaj, verMin);
     return wxPORT_OS2;
 }
 
+wxTimerImpl* wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
+{
+    return new wxOS2TimerImpl(timer);
+}
+
+wxEventLoopBase* wxGUIAppTraits::CreateEventLoop()
+{
+    return new wxEventLoop;
+}
 
 // ---------------------------------------------------------------------------
 // window information functions