]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/app.cpp
removed a condition (l. 124) that always eval to true
[wxWidgets.git] / src / os2 / app.cpp
index a40e78e3be32d7a2c34cd9f1aacf7471e4a9a105..7cb3bd50e67a802fcf359cc7835876020478b808 100644 (file)
@@ -68,6 +68,7 @@ extern wxCursor*                    g_globalCursor;
 HINSTANCE                           wxhInstance = 0;
 QMSG                                svCurrentMsg;
 wxApp*                              wxTheApp = NULL;
 HINSTANCE                           wxhInstance = 0;
 QMSG                                svCurrentMsg;
 wxApp*                              wxTheApp = NULL;
+HAB                                 vHabmain = NULL;
 
 // FIXME why not const? and not static?
 
 
 // FIXME why not const? and not static?
 
@@ -92,7 +93,11 @@ HICON wxDEFAULT_MDIPARENTFRAME_ICON  = (HICON) NULL;
 
 HBRUSH wxDisableButtonBrush = (HBRUSH) 0;
 
 
 HBRUSH wxDisableButtonBrush = (HBRUSH) 0;
 
-MRESULT wxWndProc(HWND, UINT, MPARAM, MPARAM);
+MRESULT wxWndProc( HWND
+                  ,ULONG
+                  ,MPARAM
+                  ,MPARAM
+                 );
 
 // ===========================================================================
 // implementation
 
 // ===========================================================================
 // implementation
@@ -102,7 +107,6 @@ MRESULT wxWndProc(HWND, UINT, MPARAM, MPARAM);
 // wxApp
 // ---------------------------------------------------------------------------
 
 // wxApp
 // ---------------------------------------------------------------------------
 
-#if !USE_SHARED_LIBRARY
     IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 
     BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
     IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
 
     BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
@@ -110,7 +114,6 @@ MRESULT wxWndProc(HWND, UINT, MPARAM, MPARAM);
         EVT_END_SESSION(wxApp::OnEndSession)
         EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
     END_EVENT_TABLE()
         EVT_END_SESSION(wxApp::OnEndSession)
         EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
     END_EVENT_TABLE()
-#endif
 
 //// Initialize
 bool wxApp::Initialize(
 
 //// Initialize
 bool wxApp::Initialize(
@@ -185,13 +188,14 @@ bool wxApp::RegisterWindowClasses(
   HAB                               vHab
 )
 {
   HAB                               vHab
 )
 {
-
-    if (!::WinRegisterClass( vHab
-                            ,wxFrameClassName
-                            ,(PFNWP)wxWndProc
-                            ,CS_SIZEREDRAW | CS_SYNCPAINT | CS_HITTEST | CS_CLIPCHILDREN | CS_FRAME
-                            ,0
-                           ))
+    APIRET                          rc;
+
+    if ((rc = ::WinRegisterClass( vHab
+                                 ,wxFrameClassName
+                                 ,(PFNWP)wxWndProc
+                                 ,CS_SIZEREDRAW | CS_SYNCPAINT | CS_HITTEST | CS_CLIPCHILDREN | CS_FRAME
+                                 ,0
+                                )) != 0)
     {
         wxLogLastError("RegisterClass(frame)");
 
     {
         wxLogLastError("RegisterClass(frame)");
 
@@ -397,7 +401,7 @@ int wxEntry(
 , char*                             argv[]
 )
 {
 , char*                             argv[]
 )
 {
-    HAB                             vHab;
+    HAB                             vHab = 0;
 
     if (!wxApp::Initialize(vHab))
         return 0;
 
     if (!wxApp::Initialize(vHab))
         return 0;
@@ -480,8 +484,8 @@ int wxEntry(
 
 bool wxApp::OnInitGui()
 {
 
 bool wxApp::OnInitGui()
 {
-    m_vHab = WinInitialize(0);
-    m_hMq  = WinCreateMsgQueue(m_vHab, 0);
+    vHabmain = WinInitialize(0);
+    m_hMq    = WinCreateMsgQueue(vHabmain, 0);
 
     return TRUE;
 }
 
     return TRUE;
 }
@@ -506,6 +510,7 @@ wxApp::wxApp()
 
 wxApp::~wxApp()
 {
 
 wxApp::~wxApp()
 {
+#ifdef wxUSE_UNICODE
     // Delete command-line args
     int i;
     for (i = 0; i < argc; i++)
     // Delete command-line args
     int i;
     for (i = 0; i < argc; i++)
@@ -513,6 +518,7 @@ wxApp::~wxApp()
         delete[] argv[i];
     }
     delete[] argv;
         delete[] argv[i];
     }
     delete[] argv;
+#endif
 }
 
 bool wxApp::Initialized()
 }
 
 bool wxApp::Initialized()
@@ -529,7 +535,7 @@ bool wxApp::Initialized()
 //
 bool wxApp::DoMessage()
 {
 //
 bool wxApp::DoMessage()
 {
-    BOOL                            bRc = ::WinGetMsg(m_vHab, &m_vMsg, HWND(NULL), 0, 0);
+    BOOL                            bRc = ::WinGetMsg(vHabmain, &m_vMsg, HWND(NULL), 0, 0);
 
     if (bRc == 0)
     {
 
     if (bRc == 0)
     {
@@ -591,7 +597,7 @@ bool wxApp::DoMessage()
 
                     if ( !ProcessMessage((WXMSG *)&vMsg) )
                     {
 
                     if ( !ProcessMessage((WXMSG *)&vMsg) )
                     {
-                        ::WinDispatchMsg(m_vHab, &vMsg);
+                        ::WinDispatchMsg(vHabmain, &vMsg);
                     }
                 }
                 svSavedMessages.Empty();
                     }
                 }
                 svSavedMessages.Empty();
@@ -602,7 +608,7 @@ bool wxApp::DoMessage()
         // Process the message
         if (!ProcessMessage((WXMSG *)&svCurrentMsg) )
         {
         // Process the message
         if (!ProcessMessage((WXMSG *)&svCurrentMsg) )
         {
-            ::WinDispatchMsg(m_vHab, (PQMSG)&svCurrentMsg);
+            ::WinDispatchMsg(vHabmain, (PQMSG)&svCurrentMsg);
         }
     }
     return TRUE;
         }
     }
     return TRUE;
@@ -632,7 +638,7 @@ int wxApp::MainLoop()
 #if wxUSE_THREADS
         wxMutexGuiLeaveOrEnter();
 #endif // wxUSE_THREADS
 #if wxUSE_THREADS
         wxMutexGuiLeaveOrEnter();
 #endif // wxUSE_THREADS
-        while (!::WinPeekMsg(m_vHab, &svCurrentMsg, (HWND)NULL, 0, 0, PM_NOREMOVE) &&
+        while (!::WinPeekMsg(vHabmain, &svCurrentMsg, (HWND)NULL, 0, 0, PM_NOREMOVE) &&
                 ProcessIdle() )
         {
         }
                 ProcessIdle() )
         {
         }
@@ -677,7 +683,7 @@ void wxApp::ExitMainLoop()
 
 bool wxApp::Pending()
 {
 
 bool wxApp::Pending()
 {
-    return (::WinPeekMsg(m_vHab, (PQMSG)&svCurrentMsg, (HWND)NULL, 0, 0, PM_NOREMOVE) != 0);
+    return (::WinPeekMsg(vHabmain, (PQMSG)&svCurrentMsg, (HWND)NULL, 0, 0, PM_NOREMOVE) != 0);
 }
 
 void wxApp::Dispatch()
 }
 
 void wxApp::Dispatch()
@@ -767,6 +773,12 @@ void wxApp::OnIdle(
     sbInOnIdle = FALSE;
 }
 
     sbInOnIdle = FALSE;
 }
 
+void wxWakeUpIdle()
+{
+    // **** please implement me! ****
+    // Wake up the idle handler processor, even if it is in another thread...
+}
+
 // Send idle event to all top-level windows
 bool wxApp::SendIdleEvents()
 {
 // Send idle event to all top-level windows
 bool wxApp::SendIdleEvents()
 {
@@ -866,7 +878,7 @@ void wxExit()
 // Yield to incoming messages
 bool wxYield()
 {
 // Yield to incoming messages
 bool wxYield()
 {
-    HAB                             vHab;
+    HAB                             vHab = 0;
     QMSG                            vMsg;
     // We want to go back to the main message loop
     // if we see a WM_QUIT. (?)
     QMSG                            vMsg;
     // We want to go back to the main message loop
     // if we see a WM_QUIT. (?)
@@ -917,4 +929,3 @@ void wxSetInstance(HINSTANCE hInst)
     wxhInstance = hInst;
 }
 
     wxhInstance = hInst;
 }
 
-