]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/app.cpp
changed background color reference from light gray to assigned bkgd color
[wxWidgets.git] / src / os2 / app.cpp
index 40453eb43e62ed3de05ea25ad8ea93a97043b8dd..55c540bcd58aeae0c2db31a31cdcf96432a2d1cb 100644 (file)
@@ -9,10 +9,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-    #pragma implementation "app.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -33,6 +29,8 @@
     #include "wx/dynarray.h"
     #include "wx/wxchar.h"
     #include "wx/icon.h"
     #include "wx/dynarray.h"
     #include "wx/wxchar.h"
     #include "wx/icon.h"
+    #include "wx/stdpaths.h"
+    #include "wx/filename.h"
 #endif
 
 #include "wx/log.h"
 #endif
 
 #include "wx/log.h"
 
 #endif //
 
 
 #endif //
 
-#ifndef __EMX__
+#if defined(__WATCOMC__)
+
+#include <tcpustd.h>
+
+#elif !defined(__EMX__)
 
 #define select(a,b,c,d,e) bsdselect(a,b,c,d,e)
 extern "C" int _System bsdselect(int,
 
 #define select(a,b,c,d,e) bsdselect(a,b,c,d,e)
 extern "C" int _System bsdselect(int,
@@ -80,7 +82,6 @@ extern "C" int _System bsdselect(int,
 // ---------------------------------------------------------------------------
 
 extern wxChar*                      wxBuffer;
 // ---------------------------------------------------------------------------
 
 extern wxChar*                      wxBuffer;
-extern wxList*                      wxWinHandleList;
 extern wxList WXDLLEXPORT           wxPendingDelete;
 extern wxCursor*                    g_globalCursor;
 
 extern wxList WXDLLEXPORT           wxPendingDelete;
 extern wxCursor*                    g_globalCursor;
 
@@ -115,35 +116,10 @@ struct GsocketCallbackInfo{
     void* gsock;
 };
 
     void* gsock;
 };
 
-// These defines and wrapper functions are used here and in gsockpm.c
+// These defines are used here and in gsockpm.cpp
 #define wxSockReadMask  0x01
 #define wxSockWriteMask 0x02
 
 #define wxSockReadMask  0x01
 #define wxSockWriteMask 0x02
 
-#ifdef __EMX__
-extern "C"
-int wxAppAddSocketHandler(int handle, int mask,
-                           void (*callback)(void*), void * gsock)
-{
-    return wxTheApp->AddSocketHandler(handle, mask, callback, gsock);
-}
-extern "C"
-void wxAppRemoveSocketHandler(int handle)
-{
-    wxTheApp->RemoveSocketHandler(handle);
-}
-#else
-//  Linkage mode problems using callbacks with extern C in a .cpp module
-int wxAppAddSocketHandler(int handle, int mask,
-                           void (*callback)(void*), void * gsock)
-{
-    return wxTheApp->AddSocketHandler(handle, mask, callback, gsock);
-}
-void wxAppRemoveSocketHandler(int handle)
-{
-    wxTheApp->RemoveSocketHandler(handle);
-}
-#endif
-
 void wxApp::HandleSockets()
 {
     bool pendingEvent = FALSE;
 void wxApp::HandleSockets()
 {
     bool pendingEvent = FALSE;
@@ -244,7 +220,9 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
     // OS2 has to have an anchorblock
     //
     vHabmain = WinInitialize(0);
     // OS2 has to have an anchorblock
     //
     vHabmain = WinInitialize(0);
-
+    wxFileName GetPrefix(argv[0]);
+    GetPrefix.MakeAbsolute();
+    wxStandardPaths::SetInstallPrefix(GetPrefix.GetPath());
     if (!vHabmain)
     {
         // TODO: at least give some error message here...
     if (!vHabmain)
     {
         // TODO: at least give some error message here...
@@ -261,7 +239,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
     //    wxRedirectIOToConsole();
 #endif
 
     //    wxRedirectIOToConsole();
 #endif
 
-    wxWinHandleList = new wxList(wxKEY_INTEGER);
+    wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100);
 
     // This is to foil optimizations in Visual C++ that throw out dummy.obj.
     // PLEASE DO NOT ALTER THIS.
 
     // This is to foil optimizations in Visual C++ that throw out dummy.obj.
     // PLEASE DO NOT ALTER THIS.
@@ -290,7 +268,7 @@ bool wxApp::RegisterWindowClasses(
     wxString                        sError;
 
     if (!::WinRegisterClass( vHab
     wxString                        sError;
 
     if (!::WinRegisterClass( vHab
-                            ,wxFrameClassName
+                            ,(PSZ)wxFrameClassName
                             ,wxFrameWndProc
                             ,CS_SIZEREDRAW | CS_SYNCPAINT
                             ,sizeof(ULONG)
                             ,wxFrameWndProc
                             ,CS_SIZEREDRAW | CS_SYNCPAINT
                             ,sizeof(ULONG)
@@ -298,12 +276,12 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
-                            ,wxFrameClassNameNoRedraw
+                            ,(PSZ)wxFrameClassNameNoRedraw
                             ,wxWndProc
                             ,0
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,0
                             ,sizeof(ULONG)
@@ -311,12 +289,12 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
-                            ,wxMDIFrameClassName
+                            ,(PSZ)wxMDIFrameClassName
                             ,wxWndProc
                             ,CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,CS_SIZEREDRAW | CS_MOVENOTIFY | CS_SYNCPAINT
                             ,sizeof(ULONG)
@@ -324,12 +302,12 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
-                            ,wxMDIFrameClassNameNoRedraw
+                            ,(PSZ)wxMDIFrameClassNameNoRedraw
                             ,wxWndProc
                             ,0
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,0
                             ,sizeof(ULONG)
@@ -337,12 +315,12 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
-                            ,wxMDIChildFrameClassName
+                            ,(PSZ)wxMDIChildFrameClassName
                             ,wxWndProc
                             ,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_SYNCPAINT | CS_HITTEST
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_SYNCPAINT | CS_HITTEST
                             ,sizeof(ULONG)
@@ -350,12 +328,12 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
-                            ,wxMDIChildFrameClassNameNoRedraw
+                            ,(PSZ)wxMDIChildFrameClassNameNoRedraw
                             ,wxWndProc
                             ,CS_HITTEST
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,CS_HITTEST
                             ,sizeof(ULONG)
@@ -363,12 +341,12 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
-                            ,wxPanelClassName
+                            ,(PSZ)wxPanelClassName
                             ,wxWndProc
                             ,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_HITTEST | CS_SAVEBITS | CS_SYNCPAINT
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,CS_MOVENOTIFY | CS_SIZEREDRAW | CS_HITTEST | CS_SAVEBITS | CS_SYNCPAINT
                             ,sizeof(ULONG)
@@ -376,12 +354,12 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
 
     if (!::WinRegisterClass( vHab
-                            ,wxCanvasClassName
+                            ,(PSZ)wxCanvasClassName
                             ,wxWndProc
                             ,CS_SIZEREDRAW | CS_HITTEST | CS_SYNCPAINT
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,CS_SIZEREDRAW | CS_HITTEST | CS_SYNCPAINT
                             ,sizeof(ULONG)
@@ -389,11 +367,11 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
     if (!::WinRegisterClass( vHab
         return FALSE;
     }
     if (!::WinRegisterClass( vHab
-                            ,wxCanvasClassNameNR
+                            ,(PSZ)wxCanvasClassNameNR
                             ,wxWndProc
                             ,CS_HITTEST | CS_SYNCPAINT
                             ,sizeof(ULONG)
                             ,wxWndProc
                             ,CS_HITTEST | CS_SYNCPAINT
                             ,sizeof(ULONG)
@@ -401,14 +379,14 @@ bool wxApp::RegisterWindowClasses(
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHab);
         sError = wxPMErrorToStr(vError);
-        wxLogLastError(sError);
+        wxLogLastError(sError.c_str());
         return FALSE;
     }
     return TRUE;
 } // end of wxApp::RegisterWindowClasses
 
 //
         return FALSE;
     }
     return TRUE;
 } // end of wxApp::RegisterWindowClasses
 
 //
-// Cleans up any wxWindows internal structures left lying around
+// Cleans up any wxWidgets internal structures left lying around
 //
 void wxApp::CleanUp()
 {
 //
 void wxApp::CleanUp()
 {
@@ -440,8 +418,8 @@ void wxApp::CleanUp()
 // TODO:        ::DeleteObject( wxDisableButtonBrush );
     }
 
 // TODO:        ::DeleteObject( wxDisableButtonBrush );
     }
 
-    if (wxWinHandleList)
-        delete wxWinHandleList;
+    delete wxWinHandleHash;
+    wxWinHandleHash = NULL;
 
     // Delete Message queue
     if (wxTheApp->m_hMq)
 
     // Delete Message queue
     if (wxTheApp->m_hMq)
@@ -510,8 +488,8 @@ void wxApp::OnIdle(
     if (gbInOnIdle)
         return;
 
     if (gbInOnIdle)
         return;
 
-    gbInOnIdle = TRUE;
-    
+    gbInOnIdle = true;
+
     wxAppBase::OnIdle(rEvent);
 
 #if wxUSE_DC_CACHEING
     wxAppBase::OnIdle(rEvent);
 
 #if wxUSE_DC_CACHEING
@@ -673,7 +651,7 @@ void wxApp::WakeUpIdle()
             //
             // Should never happen
             //
             //
             // Should never happen
             //
-            wxLogLastError("PostMessage(WM_NULL)");
+            wxLogLastError(wxT("PostMessage(WM_NULL)"));
         }
     }
 } // end of wxWakeUpIdle
         }
     }
 } // end of wxWakeUpIdle
@@ -683,10 +661,7 @@ HAB wxGetInstance()
     return vHabmain;
 }
 
     return vHabmain;
 }
 
-void wxSetInstance(
-  HAB                               vHab
-)
+void wxSetInstance( HAB vHab )
 {
     vHabmain = vHab;
 }
 {
     vHabmain = vHab;
 }
-