]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/app.cpp
Unicode compilation fix
[wxWidgets.git] / src / msw / app.cpp
index 944714414d379b5096848165c5950d43c116c482..359863bcc2da4915d100b87dcb209066e3bdea69 100644 (file)
@@ -19,6 +19,7 @@
 
 #ifdef __GNUG__
     #pragma implementation "app.h"
+    #pragma implementation "appbase.h"
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
@@ -43,7 +44,8 @@
     #include "wx/msgdlg.h"
     #include "wx/intl.h"
     #include "wx/dynarray.h"
-    #include "wx/wxchar.h"
+#   include "wx/wxchar.h"
+#   include "wx/icon.h"
 #endif
 
 #include "wx/log.h"
@@ -86,7 +88,6 @@
 
 #include "wx/msw/msvcrt.h"
 
-
 // ---------------------------------------------------------------------------
 // global variables
 // ---------------------------------------------------------------------------
@@ -203,15 +204,19 @@ bool wxApp::Initialize()
 
 #endif // __WIN95__
 
+#if wxUSE_OLE
+
+#ifdef __WIN16__
     // for OLE, enlarge message queue to be as large as possible
     int iMsg = 96;
-    while (!SetMessageQueue(iMsg) && (iMsg -= 8));
+    while (!SetMessageQueue(iMsg) && (iMsg -= 8))
+        ;
+#endif // Win16
 
-#if wxUSE_OLE
     // we need to initialize OLE library
     if ( FAILED(::OleInitialize(NULL)) )
         wxLogError(_("Cannot initialize OLE"));
-#endif
+#endif // wxUSE_OLE
 
 #if wxUSE_CTL3D
     if (!Ctl3dRegister(wxhInstance))
@@ -708,7 +713,7 @@ int wxEntry(WXHINSTANCE hInstance)
 
 //// Static member initialization
 
-wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
+wxAppInitializerFunction wxAppBase::m_appInitFn = (wxAppInitializerFunction) NULL;
 
 wxApp::wxApp()
 {
@@ -924,6 +929,15 @@ bool wxApp::ProcessMessage(WXMSG *wxmsg)
     HWND hWnd = msg->hwnd;
     wxWindow *wndThis = wxFindWinFromHandle((WXHWND)hWnd), *wnd;
 
+    // for some composite controls (like a combobox), wndThis might be NULL
+    // because the subcontrol is not a wxWindow, but only the control itself
+    // is - try to catch this case
+    while ( hWnd && !wndThis )
+    {
+        hWnd = ::GetParent(hWnd);
+        wndThis = wxFindWinFromHandle((WXHWND)hWnd);        
+    }
+
     // Try translations first; find the youngest window with
     // a translation table.
     for ( wnd = wndThis; wnd; wnd = wnd->GetParent() )
@@ -1053,21 +1067,6 @@ void wxApp::OnQueryEndSession(wxCloseEvent& event)
     }
 }
 
-wxLog* wxApp::CreateLogTarget()
-{
-    return new wxLogGui;
-}
-
-wxWindow* wxApp::GetTopWindow() const
-{
-    if (m_topWindow)
-        return m_topWindow;
-    else if (wxTopLevelWindows.GetCount() > 0)
-        return wxTopLevelWindows.GetFirst()->GetData();
-    else
-        return NULL;
-}
-
 int wxApp::GetComCtl32Version() const
 {
     // have we loaded COMCTL32 yet?
@@ -1141,6 +1140,30 @@ bool wxYield()
     return TRUE;
 }
 
+wxIcon
+wxApp::GetStdIcon(int which) const
+{
+    switch(which)
+    {
+        case wxICON_INFORMATION:
+            return wxIcon("wxICON_INFO");
+
+        case wxICON_QUESTION:
+            return wxIcon("wxICON_QUESTION");
+
+        case wxICON_EXCLAMATION:
+            return wxIcon("wxICON_WARNING");
+
+        default:
+            wxFAIL_MSG(_T("requested non existent standard icon"));
+            // still fall through
+
+        case wxICON_HAND:
+            return wxIcon("wxICON_ERROR");
+    }
+}
+
+
 HINSTANCE wxGetInstance()
 {
     return wxhInstance;