]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/window.cpp
Caret dropout fix
[wxWidgets.git] / src / os2 / window.cpp
index e104adeddf51891cc0af31f4e58dc75b57cad810..b0aa9ea5470c689829d8f5fde27d7c42f30e4990 100644 (file)
@@ -1,4 +1,5 @@
-// Name:        windows.cpp
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/os2/window.cpp
 // Purpose:     wxWindow
 // Author:      David Webster
 // Modified by:
 // Purpose:     wxWindow
 // Author:      David Webster
 // Modified by:
 //
 #include "wx/wxprec.h"
 
 //
 #include "wx/wxprec.h"
 
+#include "wx/window.h"
+
 #ifndef WX_PRECOMP
     #define INCL_DOS
     #define INCL_PM
     #include <os2.h>
 #ifndef WX_PRECOMP
     #define INCL_DOS
     #define INCL_PM
     #include <os2.h>
-    #include "wx/window.h"
     #include "wx/accel.h"
     #include "wx/accel.h"
-    #include "wx/setup.h"
     #include "wx/menu.h"
     #include "wx/dc.h"
     #include "wx/dcclient.h"
     #include "wx/menu.h"
     #include "wx/dc.h"
     #include "wx/dcclient.h"
     #include "wx/statusbr.h"
     #include "wx/toolbar.h"
     #include "wx/settings.h"
     #include "wx/statusbr.h"
     #include "wx/toolbar.h"
     #include "wx/settings.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/textctrl.h"
+    #include "wx/menuitem.h"
     #include <stdio.h>
 #endif
 
     #include <stdio.h>
 #endif
 
-#if     wxUSE_OWNER_DRAWN
+#include "wx/os2/dcclient.h"
+
+#if wxUSE_OWNER_DRAWN
     #include "wx/ownerdrw.h"
 #endif
 
     #include "wx/ownerdrw.h"
 #endif
 
@@ -54,9 +61,6 @@
     #include "wx/dnd.h"
 #endif
 
     #include "wx/dnd.h"
 #endif
 
-#include "wx/menuitem.h"
-#include "wx/log.h"
-
 #include "wx/os2/private.h"
 
 #if wxUSE_TOOLTIPS
 #include "wx/os2/private.h"
 
 #if wxUSE_TOOLTIPS
     #include "wx/caret.h"
 #endif // wxUSE_CARET
 
     #include "wx/caret.h"
 #endif // wxUSE_CARET
 
-#include "wx/intl.h"
-#include "wx/log.h"
-
-
-#include "wx/textctrl.h"
-
 #include <string.h>
 
 //
 #include <string.h>
 
 //
 QMSG                      s_currentMsg;
 
 #if wxUSE_MENUS_NATIVE
 QMSG                      s_currentMsg;
 
 #if wxUSE_MENUS_NATIVE
-wxMenu*                   wxCurrentPopupMenu = NULL;
+extern wxMenu*            wxCurrentPopupMenu;
 #endif // wxUSE_MENUS_NATIVE
 
 #endif // wxUSE_MENUS_NATIVE
 
-wxList*                   wxWinHandleList = NULL;
-
 // ---------------------------------------------------------------------------
 // private functions
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // private functions
 // ---------------------------------------------------------------------------
@@ -144,7 +140,7 @@ MRESULT EXPENTRY wxWndProc( HWND hWnd
                           );
 
 #ifdef  __WXDEBUG__
                           );
 
 #ifdef  __WXDEBUG__
-    const char *wxGetMessageName(int message);
+    const wxChar *wxGetMessageName(int message);
 #endif  //__WXDEBUG__
 
 wxWindowOS2* FindWindowForMouseEvent( wxWindow* pWin
 #endif  //__WXDEBUG__
 
 wxWindowOS2* FindWindowForMouseEvent( wxWindow* pWin
@@ -160,8 +156,9 @@ wxWindow* wxFindWinFromHandle(WXHWND hWnd);
 //
 // get the current state of SHIFT/CTRL keys
 //
 //
 // get the current state of SHIFT/CTRL keys
 //
-static inline bool IsShiftDown() { return (::WinGetKeyState(HWND_DESKTOP, VK_SHIFT) & 0x8000) != 0; }
-static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP, VK_CTRL) & 0x8000) != 0; }
+static inline bool IsKeyDown(LONG key) {return (::WinGetKeyState(HWND_DESKTOP, key) & 0x8000) != 0; }
+static inline bool IsShiftDown() { return IsKeyDown(VK_SHIFT); }
+static inline bool IsCtrlDown() { return IsKeyDown(VK_CTRL); }
 
 static wxWindow*                    gpWinBeingCreated = NULL;
 
 
 static wxWindow*                    gpWinBeingCreated = NULL;
 
@@ -173,9 +170,7 @@ static wxWindow*                    gpWinBeingCreated = NULL;
 // method
 #ifdef __WXUNIVERSAL__
     IMPLEMENT_ABSTRACT_CLASS(wxWindowOS2, wxWindowBase)
 // method
 #ifdef __WXUNIVERSAL__
     IMPLEMENT_ABSTRACT_CLASS(wxWindowOS2, wxWindowBase)
-#else // __WXPM__
-    IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
-#endif // __WXUNIVERSAL__/__WXPM__
+#endif // __WXUNIVERSAL__
 
 BEGIN_EVENT_TABLE(wxWindowOS2, wxWindowBase)
     EVT_ERASE_BACKGROUND(wxWindowOS2::OnEraseBackground)
 
 BEGIN_EVENT_TABLE(wxWindowOS2, wxWindowBase)
     EVT_ERASE_BACKGROUND(wxWindowOS2::OnEraseBackground)
@@ -218,17 +213,17 @@ wxWindow* wxWindowOS2::FindItem(
     }
 #endif // wxUSE_CONTROLS
 
     }
 #endif // wxUSE_CONTROLS
 
-    wxWindowList::Node*             pCurrent = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator  current = GetChildren().GetFirst();
 
 
-    while (pCurrent)
+    while (current)
     {
     {
-        wxWindow*                   pChildWin = pCurrent->GetData();
+        wxWindow*                   pChildWin = current->GetData();
         wxWindow*                   pWnd = pChildWin->FindItem(lId);
 
         if (pWnd)
             return pWnd;
 
         wxWindow*                   pWnd = pChildWin->FindItem(lId);
 
         if (pWnd)
             return pWnd;
 
-        pCurrent = pCurrent->GetNext();
+        current = current->GetNext();
     }
     return(NULL);
 } // end of wxWindowOS2::FindItem
     }
     return(NULL);
 } // end of wxWindowOS2::FindItem
@@ -241,11 +236,11 @@ wxWindow* wxWindowOS2::FindItemByHWND(
 , bool                              bControlOnly
 ) const
 {
 , bool                              bControlOnly
 ) const
 {
-    wxWindowList::Node*             pCurrent = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator current = GetChildren().GetFirst();
 
 
-    while (pCurrent)
+    while (current)
     {
     {
-        wxWindow*                   pParent = pCurrent->GetData();
+        wxWindow*                   pParent = current->GetData();
 
         //
         // Do a recursive search.
 
         //
         // Do a recursive search.
@@ -261,7 +256,7 @@ wxWindow* wxWindowOS2::FindItemByHWND(
 #endif // wxUSE_CONTROLS
             )
         {
 #endif // wxUSE_CONTROLS
             )
         {
-            wxWindow*               pItem = pCurrent->GetData();
+            wxWindow*               pItem = current->GetData();
 
             if (pItem->GetHWND() == hWnd)
                 return(pItem);
 
             if (pItem->GetHWND() == hWnd)
                 return(pItem);
@@ -271,7 +266,7 @@ wxWindow* wxWindowOS2::FindItemByHWND(
                     return(pItem);
             }
         }
                     return(pItem);
             }
         }
-        pCurrent = pCurrent->GetNext();
+        current = current->GetNext();
     }
     return(NULL);
 } // end of wxWindowOS2::FindItemByHWND
     }
     return(NULL);
 } // end of wxWindowOS2::FindItemByHWND
@@ -279,12 +274,10 @@ wxWindow* wxWindowOS2::FindItemByHWND(
 //
 // Default command handler
 //
 //
 // Default command handler
 //
-bool wxWindowOS2::OS2Command(
-  WXUINT                            WXUNUSED(uParam)
-, WXWORD                            WXUNUSED(uId)
-)
+bool wxWindowOS2::OS2Command( WXUINT WXUNUSED(uParam),
+                              WXWORD WXUNUSED(uId) )
 {
 {
-    return(FALSE);
+    return false;
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -296,13 +289,12 @@ void wxWindowOS2::Init()
     //
     // PM specific
     //
     //
     // PM specific
     //
-    m_bWinCaptured = FALSE;
+    m_bWinCaptured = false;
 
     m_fnOldWndProc          = NULL;
 
     m_fnOldWndProc          = NULL;
-    m_bUseCtl3D             = FALSE;
-    m_bMouseInWindow        = FALSE;
-    m_bLastKeydownProcessed = FALSE;
-    m_pChildrenDisabled     = NULL;
+    m_bUseCtl3D             = false;
+    m_bMouseInWindow        = false;
+    m_bLastKeydownProcessed = false;
 
     //
     // wxWnd
 
     //
     // wxWnd
@@ -321,12 +313,12 @@ void wxWindowOS2::Init()
 
     m_nXThumbSize = 0;
     m_nYThumbSize = 0;
 
     m_nXThumbSize = 0;
     m_nYThumbSize = 0;
-    m_bBackgroundTransparent = FALSE;
+    m_bBackgroundTransparent = false;
 
     //
     // As all windows are created with WS_VISIBLE style...
     //
 
     //
     // As all windows are created with WS_VISIBLE style...
     //
-    m_isShown = TRUE;
+    m_isShown = true;
 
 #if wxUSE_MOUSEEVENT_HACK
     m_lLastMouseX =
 
 #if wxUSE_MOUSEEVENT_HACK
     m_lLastMouseX =
@@ -340,7 +332,7 @@ void wxWindowOS2::Init()
 //
 wxWindowOS2::~wxWindowOS2()
 {
 //
 wxWindowOS2::~wxWindowOS2()
 {
-    m_isBeingDeleted = TRUE;
+    SendDestroyEvent();
 
     for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
     {
 
     for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent())
     {
@@ -358,30 +350,29 @@ wxWindowOS2::~wxWindowOS2()
     if (m_hWnd)
     {
         if(!::WinDestroyWindow(GetHWND()))
     if (m_hWnd)
     {
         if(!::WinDestroyWindow(GetHWND()))
+        {
             wxLogLastError(wxT("DestroyWindow"));
             wxLogLastError(wxT("DestroyWindow"));
+        }
         //
         // remove hWnd <-> wxWindow association
         //
         wxRemoveHandleAssociation(this);
     }
         //
         // remove hWnd <-> wxWindow association
         //
         wxRemoveHandleAssociation(this);
     }
-    delete m_pChildrenDisabled;
 } // end of wxWindowOS2::~wxWindowOS2
 
 // real construction (Init() must have been called before!)
 } // end of wxWindowOS2::~wxWindowOS2
 
 // real construction (Init() must have been called before!)
-bool wxWindowOS2::Create(
-  wxWindow*                         pParent
-, wxWindowID                        vId
-, const wxPoint&                    rPos
-, const wxSize&                     rSize
-, long                              lStyle
-, const wxString&                   rName
-)
+bool wxWindowOS2::Create( wxWindow*       pParent,
+                          wxWindowID      vId,
+                          const wxPoint&  rPos,
+                          const wxSize&   rSize,
+                          long            lStyle,
+                          const wxString& rName )
 {
 {
-    HWND                            hParent = NULLHANDLE;
-    ULONG                           ulCreateFlags = 0;
-    WXDWORD                         dwExStyle = 0;
+    HWND hParent = NULLHANDLE;
+    ULONG ulCreateFlags = 0;
+    WXDWORD dwExStyle = 0;
 
 
-    wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent"));
+    wxCHECK_MSG(pParent, false, wxT("can't create wxWindow without parent"));
 
 #if wxUSE_STATBOX
     //
 
 #if wxUSE_STATBOX
     //
@@ -393,9 +384,13 @@ bool wxWindowOS2::Create(
     // static box
     //
     wxASSERT_MSG( !wxDynamicCast(pParent, wxStaticBox),
     // static box
     //
     wxASSERT_MSG( !wxDynamicCast(pParent, wxStaticBox),
-                  _T("wxStaticBox can't be used as a window parent!") );
+                  wxT("wxStaticBox can't be used as a window parent!") );
 #endif // wxUSE_STATBOX
 
 #endif // wxUSE_STATBOX
 
+     // Ensure groupbox backgrounds are painted
+     if (IsKindOf(CLASSINFO(wxPanel)))
+         lStyle &= ~wxCLIP_CHILDREN;
+
     if ( !CreateBase( pParent
                      ,vId
                      ,rPos
     if ( !CreateBase( pParent
                      ,vId
                      ,rPos
@@ -404,16 +399,14 @@ bool wxWindowOS2::Create(
                      ,wxDefaultValidator
                      ,rName
                     ))
                      ,wxDefaultValidator
                      ,rName
                     ))
-        return(FALSE);
+        return false;
 
     if (pParent)
     {
         pParent->AddChild(this);
         hParent = GetWinHwnd(pParent);
 
 
     if (pParent)
     {
         pParent->AddChild(this);
         hParent = GetWinHwnd(pParent);
 
-        if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
-             pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
-           )
+        if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)))
             ulCreateFlags |= WS_CLIPSIBLINGS;
     }
 
             ulCreateFlags |= WS_CLIPSIBLINGS;
     }
 
@@ -432,7 +425,7 @@ bool wxWindowOS2::Create(
     if (lStyle & wxPOPUP_WINDOW)
     {
         ulCreateFlags &= ~WS_VISIBLE;
     if (lStyle & wxPOPUP_WINDOW)
     {
         ulCreateFlags &= ~WS_VISIBLE;
-        m_isShown = FALSE;
+        m_isShown = false;
     }
     else
     {
     }
     else
     {
@@ -450,7 +443,7 @@ bool wxWindowOS2::Create(
                      ,rSize
                      ,NULL         // Control Data
                      ,dwExStyle
                      ,rSize
                      ,NULL         // Control Data
                      ,dwExStyle
-                     ,TRUE         // Child
+                     ,true         // Child
                     ));
 } // end of wxWindowOS2::Create
 
                     ));
 } // end of wxWindowOS2::Create
 
@@ -461,7 +454,7 @@ bool wxWindowOS2::Create(
 void wxWindowOS2::SetFocus()
 {
     HWND                            hWnd = GetHwnd();
 void wxWindowOS2::SetFocus()
 {
     HWND                            hWnd = GetHwnd();
-    wxCHECK_RET( hWnd, _T("can't set focus to invalid window") );
+    wxCHECK_RET( hWnd, wxT("can't set focus to invalid window") );
 
     if (hWnd)
         ::WinSetFocus(HWND_DESKTOP, hWnd);
 
     if (hWnd)
         ::WinSetFocus(HWND_DESKTOP, hWnd);
@@ -486,79 +479,17 @@ wxWindow* wxWindowBase::DoFindFocus()
     return NULL;
 } // wxWindowBase::DoFindFocus
 
     return NULL;
 } // wxWindowBase::DoFindFocus
 
-bool wxWindowOS2::Enable(
-  bool                              bEnable
-)
+void wxWindowOS2::DoEnable( bool bEnable )
 {
 {
-    if (!wxWindowBase::Enable(bEnable))
-        return(FALSE);
-
     HWND                            hWnd = GetHwnd();
     HWND                            hWnd = GetHwnd();
-
     if ( hWnd )
         ::WinEnableWindow(hWnd, (BOOL)bEnable);
     if ( hWnd )
         ::WinEnableWindow(hWnd, (BOOL)bEnable);
+}
 
 
-    //
-    // The logic below doesn't apply to the top level windows -- otherwise
-    // showing a modal dialog would result in total greying out (and ungreying
-    // out later) of everything which would be really ugly
-    //
-    if (IsTopLevel())
-        return TRUE;
-
-    wxWindowList::Node*             pNode = GetChildren().GetFirst();
-
-    while (pNode)
-    {
-        wxWindow*                   pChild = pNode->GetData();
-
-        if (bEnable)
-        {
-            //
-            // Enable the child back unless it had been disabled before us
-            //
-            if (!m_pChildrenDisabled || !m_pChildrenDisabled->Find(pChild))
-                pChild->Enable();
-        }
-        else // we're being disabled
-        {
-            if (pChild->IsEnabled())
-            {
-                //
-                // Disable it as children shouldn't stay enabled while the
-                // parent is not
-                //
-                pChild->Disable();
-            }
-            else // child already disabled, remember it
-            {
-                //
-                // Have we created the list of disabled children already?
-                //
-                if (!m_pChildrenDisabled)
-                    m_pChildrenDisabled = new wxWindowList;
-                m_pChildrenDisabled->Append(pChild);
-            }
-        }
-        pNode = pNode->GetNext();
-    }
-    if (bEnable && m_pChildrenDisabled)
-    {
-        //
-        // We don't need this list any more, don't keep unused memory
-        //
-        delete m_pChildrenDisabled;
-        m_pChildrenDisabled = NULL;
-    }
-    return TRUE;
-} // end of wxWindowOS2::Enable
-
-bool wxWindowOS2::Show(
-  bool                              bShow
-)
+bool wxWindowOS2::Show( bool bShow )
 {
     if (!wxWindowBase::Show(bShow))
 {
     if (!wxWindowBase::Show(bShow))
-        return(FALSE);
+        return false;
 
     HWND                            hWnd = GetHwnd();
 
 
     HWND                            hWnd = GetHwnd();
 
@@ -568,7 +499,7 @@ bool wxWindowOS2::Show(
     {
         ::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER);
     }
     {
         ::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER);
     }
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::Show
 
 void wxWindowOS2::Raise()
 } // end of wxWindowOS2::Show
 
 void wxWindowOS2::Raise()
@@ -581,73 +512,66 @@ void wxWindowOS2::Lower()
     ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER | SWP_DEACTIVATE);
 } // end of wxWindowOS2::Lower
 
     ::WinSetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_ZORDER | SWP_DEACTIVATE);
 } // end of wxWindowOS2::Lower
 
-void wxWindowOS2::SetTitle(
-  const wxString&                   rTitle
-)
+void wxWindowOS2::SetLabel( const wxString& label )
 {
 {
-    ::WinSetWindowText(GetHwnd(), rTitle.c_str());
-} // end of wxWindowOS2::SetTitle
+    ::WinSetWindowText(GetHwnd(), label.c_str());
+} // end of wxWindowOS2::SetLabel
 
 
-wxString wxWindowOS2::GetTitle() const
+wxString wxWindowOS2::GetLabel() const
 {
     return wxGetWindowText(GetHWND());
 {
     return wxGetWindowText(GetHWND());
-} // end of wxWindowOS2::GetTitle
+} // end of wxWindowOS2::GetLabel
 
 void wxWindowOS2::DoCaptureMouse()
 {
 
 void wxWindowOS2::DoCaptureMouse()
 {
-    HWND                            hWnd = GetHwnd();
+    HWND hWnd = GetHwnd();
 
     if (hWnd && !m_bWinCaptured)
     {
         ::WinSetCapture(HWND_DESKTOP, hWnd);
 
     if (hWnd && !m_bWinCaptured)
     {
         ::WinSetCapture(HWND_DESKTOP, hWnd);
-        m_bWinCaptured = TRUE;
+        m_bWinCaptured = true;
     }
     }
-} // end of wxWindowOS2::GetTitle
+} // end of wxWindowOS2::DoCaptureMouse
 
 void wxWindowOS2::DoReleaseMouse()
 {
     if (m_bWinCaptured)
     {
         ::WinSetCapture(HWND_DESKTOP, NULLHANDLE);
 
 void wxWindowOS2::DoReleaseMouse()
 {
     if (m_bWinCaptured)
     {
         ::WinSetCapture(HWND_DESKTOP, NULLHANDLE);
-        m_bWinCaptured = FALSE;
+        m_bWinCaptured = false;
     }
 } // end of wxWindowOS2::ReleaseMouse
 
 /* static */ wxWindow* wxWindowBase::GetCapture()
 {
     HWND hwnd = ::WinQueryCapture(HWND_DESKTOP);
     }
 } // end of wxWindowOS2::ReleaseMouse
 
 /* static */ wxWindow* wxWindowBase::GetCapture()
 {
     HWND hwnd = ::WinQueryCapture(HWND_DESKTOP);
-    return hwnd ? wxFindWinFromHandle((WXHWND)hwnd) : (wxWindow *)NULL;
+    return hwnd ? wxFindWinFromHandle((WXHWND)hwnd) : NULL;
 } // end of wxWindowBase::GetCapture
 
 } // end of wxWindowBase::GetCapture
 
-bool wxWindowOS2::SetFont(
-  const wxFont&                     rFont
-)
+bool wxWindowOS2::SetFont( const wxFont& rFont )
 {
     if (!wxWindowBase::SetFont(rFont))
     {
         // nothing to do
 {
     if (!wxWindowBase::SetFont(rFont))
     {
         // nothing to do
-        return(FALSE);
+        return false;
     }
 
     }
 
-    HWND                            hWnd = GetHwnd();
+    HWND hWnd = GetHwnd();
 
 
-    wxOS2SetFont( hWnd
-                 ,rFont
-                );
-    return(TRUE);
+    wxOS2SetFont( hWnd, rFont );
+    return true;
 } // end of wxWindowOS2::SetFont
 
 } // end of wxWindowOS2::SetFont
 
-bool wxWindowOS2::SetCursor(
-  const wxCursor&                   rCursor
-) // check if base implementation is OK
+// check if base implementation is OK
+bool wxWindowOS2::SetCursor( const wxCursor& rCursor)
 {
     if ( !wxWindowBase::SetCursor(rCursor))
     {
         // no change
 {
     if ( !wxWindowBase::SetCursor(rCursor))
     {
         // no change
-        return FALSE;
+        return false;
     }
 
     }
 
-    if ( m_cursor.Ok() ) {
+    if ( m_cursor.IsOk() ) {
         HWND                            hWnd = GetHwnd();
         POINTL                          vPoint;
         RECTL                           vRect;
         HWND                            hWnd = GetHwnd();
         POINTL                          vPoint;
         RECTL                           vRect;
@@ -660,7 +584,7 @@ bool wxWindowOS2::SetCursor(
             ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
         }
     }
             ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
         }
     }
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::SetCursor
 
 void wxWindowOS2::WarpPointer(
 } // end of wxWindowOS2::SetCursor
 
 void wxWindowOS2::WarpPointer(
@@ -729,18 +653,20 @@ void wxWindowOS2::SetScrollPos(
         ::WinSendMsg(m_hWndScrollBarVert, SBM_SETPOS, (MPARAM)nPos, (MPARAM)NULL);
 } // end of wxWindowOS2::SetScrollPos
 
         ::WinSendMsg(m_hWndScrollBarVert, SBM_SETPOS, (MPARAM)nPos, (MPARAM)NULL);
 } // end of wxWindowOS2::SetScrollPos
 
-void wxWindowOS2::SetScrollbar(
-  int                               nOrient
-, int                               nPos
-, int                               nThumbVisible
-, int                               nRange
-, bool                              WXUNUSED(bRefresh)
-)
+void wxWindowOS2::SetScrollbar( int  nOrient,
+                                int  nPos,
+                                int  nThumbVisible,
+                                int  nRange,
+                                bool WXUNUSED(bRefresh) )
 {
     HWND                            hWnd = GetHwnd();
     int                             nOldRange = nRange - nThumbVisible;
     int                             nRange1 = nOldRange;
     int                             nPageSize = nThumbVisible;
 {
     HWND                            hWnd = GetHwnd();
     int                             nOldRange = nRange - nThumbVisible;
     int                             nRange1 = nOldRange;
     int                             nPageSize = nThumbVisible;
+    int         nVSBWidth  = wxSystemSettingsNative::GetMetric(wxSYS_VSCROLL_X,
+                                                               this);
+    int         nHSBHeight = wxSystemSettingsNative::GetMetric(wxSYS_HSCROLL_Y,
+                                                               this);
 
     SBCDATA                         vInfo;
     ULONG                           ulStyle = WS_VISIBLE | WS_SYNCPAINT;
 
     SBCDATA                         vInfo;
     ULONG                           ulStyle = WS_VISIBLE | WS_SYNCPAINT;
@@ -777,7 +703,7 @@ void wxWindowOS2::SetScrollbar(
     vInfo.cb = sizeof(SBCDATA);
     vInfo.posFirst = 0;
     vInfo.posLast = (SHORT)nRange1;
     vInfo.cb = sizeof(SBCDATA);
     vInfo.posFirst = 0;
     vInfo.posLast = (SHORT)nRange1;
-    vInfo.posThumb = nPos;
+    vInfo.posThumb = (SHORT)nPos;
 
     if (nOrient == wxHORIZONTAL )
     {
 
     if (nOrient == wxHORIZONTAL )
     {
@@ -802,8 +728,8 @@ void wxWindowOS2::SetScrollbar(
                                                     ,ulStyle
                                                     ,vSwp.x
                                                     ,vSwp.y
                                                     ,ulStyle
                                                     ,vSwp.x
                                                     ,vSwp.y
-                                                    ,vSwp.cx - 20
-                                                    ,20
+                                                    ,vSwp.cx - nVSBWidth
+                                                    ,nHSBHeight
                                                     ,hWnd
                                                     ,HWND_TOP
                                                     ,60000
                                                     ,hWnd
                                                     ,HWND_TOP
                                                     ,60000
@@ -820,18 +746,19 @@ void wxWindowOS2::SetScrollbar(
             // origin, not the frame's client window origin.
             // The starting x position is the same as the starting x position
             // of the owner, but in terms of the parent frame.
             // origin, not the frame's client window origin.
             // The starting x position is the same as the starting x position
             // of the owner, but in terms of the parent frame.
-            // The starting y position is 20 pels below the origin of the
-            // owner in terms of the parent frame.
-            // The horz bar is the same width as the owner and 20 pels high.
+            // The starting y position is wxSYS_HSCROLL_Y pels below the
+            // origin of the owner in terms of the parent frame.
+            // The horz bar is the same width as the owner and wxSYS_HSCROLL_Y
+            // pels high.
             //
             if (nRange1 >= nThumbVisible)
             {
                 ::WinSetWindowPos( m_hWndScrollBarHorz
                                   ,HWND_TOP
                                   ,vSwp.x + vSwpOwner.x
             //
             if (nRange1 >= nThumbVisible)
             {
                 ::WinSetWindowPos( m_hWndScrollBarHorz
                                   ,HWND_TOP
                                   ,vSwp.x + vSwpOwner.x
-                                  ,(vSwp.y + vSwpOwner.y) - 20
+                                  ,(vSwp.y + vSwpOwner.y) - nHSBHeight
                                   ,vSwpOwner.cx
                                   ,vSwpOwner.cx
-                                  ,20
+                                  ,nHSBHeight
                                   ,SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER
                                  );
                 ::WinSendMsg( m_hWndScrollBarHorz
                                   ,SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER
                                  );
                 ::WinSendMsg( m_hWndScrollBarHorz
@@ -872,10 +799,10 @@ void wxWindowOS2::SetScrollbar(
                                                     ,WC_SCROLLBAR
                                                     ,(PSZ)NULL
                                                     ,ulStyle
                                                     ,WC_SCROLLBAR
                                                     ,(PSZ)NULL
                                                     ,ulStyle
-                                                    ,vSwp.x + vSwp.cx - 20
-                                                    ,vSwp.y + 20
-                                                    ,20
-                                                    ,vSwp.cy - 20
+                                                    ,vSwp.x + vSwp.cx - nVSBWidth
+                                                    ,vSwp.y + nHSBHeight
+                                                    ,nVSBWidth
+                                                    ,vSwp.cy - nHSBHeight
                                                     ,hWnd
                                                     ,HWND_TOP
                                                     ,60001
                                                     ,hWnd
                                                     ,HWND_TOP
                                                     ,60001
@@ -898,7 +825,7 @@ void wxWindowOS2::SetScrollbar(
             // position of the scrollbar relative to the parent frame (the vert
             // scrollbar is on the right and starts at the bottom of the
             // owner window).
             // position of the scrollbar relative to the parent frame (the vert
             // scrollbar is on the right and starts at the bottom of the
             // owner window).
-            // It is 20 pels wide and the same height as the owner.
+            // It is wxSYS_VSCROLL_X pels wide and the same height as the owner.
             //
             if (nRange1 >= nThumbVisible)
             {
             //
             if (nRange1 >= nThumbVisible)
             {
@@ -906,7 +833,7 @@ void wxWindowOS2::SetScrollbar(
                                   ,HWND_TOP
                                   ,vSwp.x + vSwpOwner.x + vSwpOwner.cx
                                   ,vSwp.y + vSwpOwner.y
                                   ,HWND_TOP
                                   ,vSwp.x + vSwpOwner.x + vSwpOwner.cx
                                   ,vSwp.y + vSwpOwner.y
-                                  ,20
+                                  ,nVSBWidth
                                   ,vSwpOwner.cy
                                   ,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW
                                  );
                                   ,vSwpOwner.cy
                                   ,SWP_ACTIVATE | SWP_MOVE | SWP_SIZE | SWP_SHOW
                                  );
@@ -930,16 +857,15 @@ void wxWindowOS2::SetScrollbar(
     }
 } // end of wxWindowOS2::SetScrollbar
 
     }
 } // end of wxWindowOS2::SetScrollbar
 
-void wxWindowOS2::ScrollWindow(
-  int                               nDx
-, int                               nDy
-, const wxRect*                     pRect
-)
+
+void wxWindowOS2::ScrollWindow( int nDx,
+                                int nDy,
+                                const wxRect* pRect )
 {
 {
-    RECTL                           vRect;
+    RECTL vRect;
 
     ::WinQueryWindowRect(GetHwnd(), &vRect);
 
     ::WinQueryWindowRect(GetHwnd(), &vRect);
-    int                             height = vRect.yTop;
+    int height = vRect.yTop;
     if (pRect)
     {
         vRect.xLeft   = pRect->x;
     if (pRect)
     {
         vRect.xLeft   = pRect->x;
@@ -1066,10 +992,8 @@ void wxWindowOS2::SetWindowStyleFlag(
     }
 } // end of wxWindowOS2::SetWindowStyleFlag
 
     }
 } // end of wxWindowOS2::SetWindowStyleFlag
 
-WXDWORD wxWindowOS2::OS2GetStyle(
-  long                              lFlags
-, WXDWORD*                          pdwExstyle
-) const
+WXDWORD wxWindowOS2::OS2GetStyle( long     lFlags,
+                                  WXDWORD* WXUNUSED(pdwExstyle) ) const
 {
     WXDWORD                         dwStyle = 0L;
 
 {
     WXDWORD                         dwStyle = 0L;
 
@@ -1080,7 +1004,7 @@ WXDWORD wxWindowOS2::OS2GetStyle(
         dwStyle |= WS_CLIPSIBLINGS;
 
     return dwStyle;
         dwStyle |= WS_CLIPSIBLINGS;
 
     return dwStyle;
-} // end of wxWindowMSW::MSWGetStyle
+} // end of wxWindowOS2::OS2GetStyle
 
 //
 // Make a Windows extended style from the given wxWidgets window style
 
 //
 // Make a Windows extended style from the given wxWidgets window style
@@ -1139,7 +1063,7 @@ void wxWindowOS2::OnIdle(
             //
             // Generate a LEAVE event
             //
             //
             // Generate a LEAVE event
             //
-            m_bMouseInWindow = FALSE;
+            m_bMouseInWindow = false;
 
             //
             // Unfortunately the mouse button and keyboard state may have changed
 
             //
             // Unfortunately the mouse button and keyboard state may have changed
@@ -1160,28 +1084,24 @@ void wxWindowOS2::OnIdle(
                            ,vPoint.y
                            ,nState
                           );
                            ,vPoint.y
                            ,nState
                           );
-            (void)GetEventHandler()->ProcessEvent(rEvent);
+            (void)HandleWindowEvent(rEvent);
         }
     }
         }
     }
-    if (wxUpdateUIEvent::CanUpdate(this))
-        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
 } // end of wxWindowOS2::OnIdle
 
 //
 // Set this window to be the child of 'parent'.
 //
 } // end of wxWindowOS2::OnIdle
 
 //
 // Set this window to be the child of 'parent'.
 //
-bool wxWindowOS2::Reparent(
-  wxWindow*                         pParent
-)
+bool wxWindowOS2::Reparent( wxWindowBase* pParent)
 {
     if (!wxWindowBase::Reparent(pParent))
 {
     if (!wxWindowBase::Reparent(pParent))
-        return FALSE;
+        return false;
 
 
-    HWND                            hWndChild = GetHwnd();
-    HWND                            hWndParent = GetParent() ? GetWinHwnd(GetParent()) : (HWND)0;
+    HWND hWndChild = GetHwnd();
+    HWND hWndParent = GetParent() ? GetWinHwnd(GetParent()) : (HWND)0;
 
     ::WinSetParent(hWndChild, hWndParent, TRUE);
 
     ::WinSetParent(hWndChild, hWndParent, TRUE);
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::Reparent
 
 void wxWindowOS2::Update()
 } // end of wxWindowOS2::Reparent
 
 void wxWindowOS2::Update()
@@ -1189,12 +1109,12 @@ void wxWindowOS2::Update()
     ::WinUpdateWindow(GetHwnd());
 } // end of wxWindowOS2::Update
 
     ::WinUpdateWindow(GetHwnd());
 } // end of wxWindowOS2::Update
 
-void wxWindowOS2::Freeze()
+void wxWindowOS2::DoFreeze()
 {
    ::WinSendMsg(GetHwnd(), WM_VRNDISABLED, (MPARAM)0, (MPARAM)0);
 } // end of wxWindowOS2::Freeze
 
 {
    ::WinSendMsg(GetHwnd(), WM_VRNDISABLED, (MPARAM)0, (MPARAM)0);
 } // end of wxWindowOS2::Freeze
 
-void wxWindowOS2::Thaw()
+void wxWindowOS2::DoThaw()
 {
    ::WinSendMsg(GetHwnd(), WM_VRNENABLED, (MPARAM)TRUE, (MPARAM)0);
 
 {
    ::WinSendMsg(GetHwnd(), WM_VRNENABLED, (MPARAM)TRUE, (MPARAM)0);
 
@@ -1205,22 +1125,20 @@ void wxWindowOS2::Thaw()
     Refresh();
 } // end of wxWindowOS2::Thaw
 
     Refresh();
 } // end of wxWindowOS2::Thaw
 
-void wxWindowOS2::Refresh(
-  bool                              bEraseBack
-, const wxRect*                     pRect
-)
+void wxWindowOS2::Refresh( bool bEraseBack,
+                           const wxRect* pRect )
 {
 {
-    HWND                            hWnd = GetHwnd();
+    HWND hWnd = GetHwnd();
 
     if (hWnd)
     {
         if (pRect)
         {
 
     if (hWnd)
     {
         if (pRect)
         {
-            RECTL                   vOs2Rect;
-            int                     height;
+            RECTL vOs2Rect;
+            int   height;
 
             ::WinQueryWindowRect(GetHwnd(), &vOs2Rect);
 
             ::WinQueryWindowRect(GetHwnd(), &vOs2Rect);
-           height = vOs2Rect.yTop;
+            height = vOs2Rect.yTop;
             vOs2Rect.xLeft   = pRect->x;
             vOs2Rect.yTop    = height - pRect->y;
             vOs2Rect.xRight  = pRect->x + pRect->width;
             vOs2Rect.xLeft   = pRect->x;
             vOs2Rect.yTop    = height - pRect->y;
             vOs2Rect.xRight  = pRect->x + pRect->width;
@@ -1317,7 +1235,10 @@ void wxWindowOS2::DoGetPosition(
 , int*                              pY
 ) const
 {
 , int*                              pY
 ) const
 {
-    HWND                            hWnd = GetHwnd();
+    //
+    // Return parameters assume wxWidgets coordinate system
+    //
+    HWND                            hWnd;
     SWP                             vSwp;
     POINTL                          vPoint;
     wxWindow*                       pParent = GetParent();
     SWP                             vSwp;
     POINTL                          vPoint;
     wxWindow*                       pParent = GetParent();
@@ -1327,17 +1248,30 @@ void wxWindowOS2::DoGetPosition(
     // the WIN32 WinGetRect, but unlike WinGetRect which returns the window
     // origin position in screen coordinates, WinQueryWindowRect returns it
     // relative to itself, i.e. (0,0).  To get the same under PM we must
     // the WIN32 WinGetRect, but unlike WinGetRect which returns the window
     // origin position in screen coordinates, WinQueryWindowRect returns it
     // relative to itself, i.e. (0,0).  To get the same under PM we must
-    // us WinQueryWindowPos.  This call, unlike the WIN32 call, however,
+    // use WinQueryWindowPos.  This call, unlike the WIN32 call, however,
     // returns a position relative to it's parent, so no parent adujstments
     // are needed under OS/2.  Also, windows should be created using
     // returns a position relative to it's parent, so no parent adujstments
     // are needed under OS/2.  Also, windows should be created using
-    // wxWindow coordinates, i.e 0,0 is the TOP left so vSwp will already
-    // reflect that.
+    // wxWindow coordinates, i.e. 0,0 is the TOP left.
     //
     //
+    if (IsKindOf(CLASSINFO(wxFrame)))
+    {
+        wxFrame*                    pFrame = wxDynamicCast(this, wxFrame);
+        hWnd = pFrame->GetFrame();
+    }
+    else
+        hWnd = GetHwnd();
+
     ::WinQueryWindowPos(hWnd, &vSwp);
 
     vPoint.x = vSwp.x;
     vPoint.y = vSwp.y;
 
     ::WinQueryWindowPos(hWnd, &vSwp);
 
     vPoint.x = vSwp.x;
     vPoint.y = vSwp.y;
 
+    // We need to convert to wxWidgets coordinates
+    int vHeight;
+    DoGetSize(NULL,&vHeight);
+    wxWindow* pWindow = wxDynamicCast(this,wxWindow);
+    vPoint.y = pWindow->GetOS2ParentHeight(pParent) - vPoint.y - vHeight;
+
     //
     // We may be faking the client origin. So a window that's really at (0,
     // 30) may appear (to wxWin apps) to be at (0, 0).
     //
     // We may be faking the client origin. So a window that's really at (0,
     // 30) may appear (to wxWin apps) to be at (0, 0).
@@ -1469,8 +1403,12 @@ void wxWindowOS2::DoMoveWindow(
 , int                               nHeight
 )
 {
 , int                               nHeight
 )
 {
+    //
+    // Input parameters assume wxWidgets coordinate system
+    //
     RECTL                           vRect;
     wxWindow*                       pParent = GetParent();
     RECTL                           vRect;
     wxWindow*                       pParent = GetParent();
+    HWND                            hWnd = GetHwnd();
 
     if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
     {
 
     if (pParent && !IsKindOf(CLASSINFO(wxDialog)))
     {
@@ -1500,64 +1438,26 @@ void wxWindowOS2::DoMoveWindow(
     if (IsKindOf(CLASSINFO(wxFrame)))
     {
         RECTL                       vFRect;
     if (IsKindOf(CLASSINFO(wxFrame)))
     {
         RECTL                       vFRect;
-        HWND                        hWndFrame;
         int                         nWidthFrameDelta = 0;
         int                         nHeightFrameDelta = 0;
         int                         nWidthFrameDelta = 0;
         int                         nHeightFrameDelta = 0;
-        int                         nHeightFrame = 0;
-        int                         nWidthFrame = 0;
         wxFrame*                    pFrame;
 
         pFrame = wxDynamicCast(this, wxFrame);
         wxFrame*                    pFrame;
 
         pFrame = wxDynamicCast(this, wxFrame);
-        hWndFrame = pFrame->GetFrame();
-        ::WinQueryWindowRect(hWndFrame, &vRect);
-        ::WinMapWindowPoints(hWndFrame, HWND_DESKTOP, (PPOINTL)&vRect, 2);
+        hWnd = pFrame->GetFrame();
+        ::WinQueryWindowRect(hWnd, &vRect);
+        ::WinMapWindowPoints(hWnd, HWND_DESKTOP, (PPOINTL)&vRect, 2);
         vFRect = vRect;
         vFRect = vRect;
-        ::WinCalcFrameRect(hWndFrame, &vRect, TRUE);
+        ::WinCalcFrameRect(hWnd, &vRect, TRUE);
         nWidthFrameDelta = ((vRect.xLeft - vFRect.xLeft) + (vFRect.xRight - vRect.xRight));
         nHeightFrameDelta = ((vRect.yBottom - vFRect.yBottom) + (vFRect.yTop - vRect.yTop));
         nWidthFrameDelta = ((vRect.xLeft - vFRect.xLeft) + (vFRect.xRight - vRect.xRight));
         nHeightFrameDelta = ((vRect.yBottom - vFRect.yBottom) + (vFRect.yTop - vRect.yTop));
-        nWidthFrame = vFRect.xRight - vFRect.xLeft;
-        nHeightFrame = vFRect.yTop - vFRect.yBottom;
-
-        if (nWidth == vFRect.xRight - vFRect.xLeft &&
-            nHeight == vFRect.yTop - vFRect.yBottom)
-        {
-            //
-            // In this case the caller is not aware of OS/2's need to size both
-            // the frame and it's client and is really only moving the window,
-            // not resizeing it.  So move the frame, and back off the sizes
-            // for a proper client fit.
-            //
-            ::WinSetWindowPos( hWndFrame
-                              ,HWND_TOP
-                              ,(LONG)nX - (vRect.xLeft - vFRect.xLeft)
-                              ,(LONG)nY - (vRect.yBottom - vFRect.yBottom)
-                              ,(LONG)0
-                              ,(LONG)0
-                              ,SWP_MOVE
-                             );
-            nX += (vRect.xLeft - vFRect.xLeft);
-            nY += (vRect.yBottom - vFRect.yBottom);
-            nWidth -= nWidthFrameDelta;
-            nHeight -= nHeightFrameDelta;
-        }
-        else
-        {
-            if (nWidth > nWidthFrame - nHeightFrameDelta ||
-                nHeight > nHeightFrame - nHeightFrameDelta)
-            {
-                ::WinSetWindowPos( hWndFrame
-                                  ,HWND_TOP
-                                  ,(LONG)nX - (vRect.xLeft - vFRect.xLeft)
-                                  ,(LONG)nY - (vRect.yBottom - vFRect.yBottom)
-                                  ,(LONG)nWidth + nWidthFrameDelta
-                                  ,(LONG)nHeight + nHeightFrameDelta
-                                  ,SWP_MOVE | SWP_SIZE
-                                 );
-            }
-        }
+        // Input values refer to the window position relative to its parent
+        // which may be the Desktop so we need to calculate
+        // the new frame values to keep the wxWidgets frame origin constant
+        nY -= nHeightFrameDelta;
+        nWidth += nWidthFrameDelta;
+        nHeight += nHeightFrameDelta;
     }
     }
-
-    ::WinSetWindowPos( GetHwnd()
+    ::WinSetWindowPos( hWnd
                       ,HWND_TOP
                       ,(LONG)nX
                       ,(LONG)nY
                       ,HWND_TOP
                       ,(LONG)nX
                       ,(LONG)nY
@@ -1569,17 +1469,15 @@ void wxWindowOS2::DoMoveWindow(
         //
         // Uninitialized
         //
         //
         // Uninitialized
         //
-        ::WinQueryWindowPos(GetHwnd(), &m_vWinSwp);
+        ::WinQueryWindowPos(hWnd, &m_vWinSwp);
     else
     {
     else
     {
-        int                         nYDiff = m_vWinSwp.cy - nHeight;
-
         //
         // Handle resizing of scrolled windows.  The target or window to
         //
         // Handle resizing of scrolled windows.  The target or window to
-        // be scrolled is the owner (gets the scroll notificaitons).  The
+        // be scrolled is the owner (gets the scroll notifications).  The
         // parent is usually the parent frame of the scrolled panel window.
         // In order to show the scrollbars the target window will be shrunk
         // parent is usually the parent frame of the scrolled panel window.
         // In order to show the scrollbars the target window will be shrunk
-        // by the size of the scroll bar widths (20) and moved in the X and Y
+        // by the size of the scroll bar widths and moved in the X and Y
         // directon.  That value will be computed as part of the diff for
         // moving the children.  Everytime the window is sized the
         // toplevel OnSize is going to resize the panel to fit the client
         // directon.  That value will be computed as part of the diff for
         // moving the children.  Everytime the window is sized the
         // toplevel OnSize is going to resize the panel to fit the client
@@ -1588,26 +1486,28 @@ void wxWindowOS2::DoMoveWindow(
         // which will cause the scrollbars to be displayed via the SetScrollbar
         // call in CWindow.
         //
         // which will cause the scrollbars to be displayed via the SetScrollbar
         // call in CWindow.
         //
-        if ( IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
-             IsKindOf(CLASSINFO(wxScrolledWindow))
-           )
+        if (IsKindOf(CLASSINFO(wxScrolledWindow)))
         {
             int                     nAdjustWidth  = 0;
             int                     nAdjustHeight = 0;
         {
             int                     nAdjustWidth  = 0;
             int                     nAdjustHeight = 0;
+            int nHSBHeight = wxSystemSettingsNative::GetMetric(wxSYS_HSCROLL_Y,
+                                                               this);
+            int nVSBWidth  = wxSystemSettingsNative::GetMetric(wxSYS_VSCROLL_X,
+                                                               this);
             SWP                     vSwpScroll;
 
             if (GetScrollBarHorz() == NULLHANDLE ||
                 !WinIsWindowShowing(GetScrollBarHorz()))
                 nAdjustHeight = 0L;
             else
             SWP                     vSwpScroll;
 
             if (GetScrollBarHorz() == NULLHANDLE ||
                 !WinIsWindowShowing(GetScrollBarHorz()))
                 nAdjustHeight = 0L;
             else
-                nAdjustHeight = 20L;
+                nAdjustHeight = nHSBHeight;
             if (GetScrollBarVert() == NULLHANDLE ||
                 !WinIsWindowShowing(GetScrollBarVert()))
                 nAdjustWidth = 0L;
             else
             if (GetScrollBarVert() == NULLHANDLE ||
                 !WinIsWindowShowing(GetScrollBarVert()))
                 nAdjustWidth = 0L;
             else
-                nAdjustWidth = 20L;
-            ::WinQueryWindowPos(GetHWND(), &vSwpScroll);
-            ::WinSetWindowPos( GetHWND()
+                nAdjustWidth = nVSBWidth;
+            ::WinQueryWindowPos(hWnd, &vSwpScroll);
+            ::WinSetWindowPos( hWnd
                               ,HWND_TOP
                               ,vSwpScroll.x
                               ,vSwpScroll.y + nAdjustHeight
                               ,HWND_TOP
                               ,vSwpScroll.x
                               ,vSwpScroll.y + nAdjustHeight
@@ -1615,10 +1515,8 @@ void wxWindowOS2::DoMoveWindow(
                               ,vSwpScroll.cy - nAdjustHeight
                               ,SWP_MOVE | SWP_SIZE
                              );
                               ,vSwpScroll.cy - nAdjustHeight
                               ,SWP_MOVE | SWP_SIZE
                              );
-            nYDiff += nAdjustHeight;
         }
         }
-        MoveChildren(nYDiff);
-        ::WinQueryWindowPos(GetHwnd(), &m_vWinSwp);
+        ::WinQueryWindowPos(hWnd, &m_vWinSwp);
     }
 } // end of wxWindowOS2::DoMoveWindow
 
     }
 } // end of wxWindowOS2::DoMoveWindow
 
@@ -1632,22 +1530,24 @@ void wxWindowOS2::DoMoveWindow(
 // the width/height to best suit our contents, otherwise we reuse the current
 // width/height
 //
 // the width/height to best suit our contents, otherwise we reuse the current
 // width/height
 //
-void wxWindowOS2::DoSetSize(
-  int                               nX
-, int                               nY
-, int                               nWidth
-, int                               nHeight
-, int                               nSizeFlags
-)
+void wxWindowOS2::DoSetSize( int nX,
+                             int nY,
+                             int nWidth,
+                             int nHeight,
+                             int nSizeFlags )
 {
 {
+    //
+    // Input & output parameters assume wxWidgets coordinate system
+    //
+
     //
     // Get the current size and position...
     //
     //
     // Get the current size and position...
     //
-    int                             nCurrentX;
-    int                             nCurrentY;
-    int                             nCurrentWidth;
-    int                             nCurrentHeight;
-    wxSize                          vSize(-1, -1);
+    int    nCurrentX;
+    int    nCurrentY;
+    int    nCurrentWidth;
+    int    nCurrentHeight;
+    wxSize vSize = wxDefaultSize;
 
     GetPosition(&nCurrentX, &nCurrentY);
     GetSize(&nCurrentWidth, &nCurrentHeight);
 
     GetPosition(&nCurrentX, &nCurrentY);
     GetSize(&nCurrentWidth, &nCurrentHeight);
@@ -1655,25 +1555,20 @@ void wxWindowOS2::DoSetSize(
     //
     // ... and don't do anything (avoiding flicker) if it's already ok
     //
     //
     // ... and don't do anything (avoiding flicker) if it's already ok
     //
-    //
-    // Must convert Y coords to test for equality under OS/2
-    //
-    int                             nY2 = nY;
-
-    if (nX == nCurrentX && nY2 == nCurrentY &&
+    if (nX == nCurrentX && nY == nCurrentY &&
         nWidth == nCurrentWidth && nHeight == nCurrentHeight)
     {
         return;
     }
 
         nWidth == nCurrentWidth && nHeight == nCurrentHeight)
     {
         return;
     }
 
-    if (nX == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    if (nX == wxDefaultCoord && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
         nX = nCurrentX;
         nX = nCurrentX;
-    if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
+    if (nY == wxDefaultCoord && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
         nY = nCurrentY;
 
     AdjustForParentClientOrigin(nX, nY, nSizeFlags);
 
         nY = nCurrentY;
 
     AdjustForParentClientOrigin(nX, nY, nSizeFlags);
 
-    if (nWidth == -1)
+    if (nWidth == wxDefaultCoord)
     {
         if (nSizeFlags & wxSIZE_AUTO_WIDTH)
         {
     {
         if (nSizeFlags & wxSIZE_AUTO_WIDTH)
         {
@@ -1689,11 +1584,11 @@ void wxWindowOS2::DoSetSize(
         }
     }
 
         }
     }
 
-    if (nHeight == -1)
+    if (nHeight == wxDefaultCoord)
     {
         if (nSizeFlags & wxSIZE_AUTO_HEIGHT)
         {
     {
         if (nSizeFlags & wxSIZE_AUTO_HEIGHT)
         {
-            if (vSize.x == -1)
+            if (vSize.x == wxDefaultCoord)
             {
                 vSize = DoGetBestSize();
             }
             {
                 vSize = DoGetBestSize();
             }
@@ -1706,82 +1601,28 @@ void wxWindowOS2::DoSetSize(
         }
     }
 
         }
     }
 
-    DoMoveWindow( nX
-                 ,nY
-                 ,nWidth
-                 ,nHeight
-                );
+    DoMoveWindow( nX, nY, nWidth, nHeight );
 } // end of wxWindowOS2::DoSetSize
 
 } // end of wxWindowOS2::DoSetSize
 
-void wxWindowOS2::DoSetClientSize(
-  int                               nWidth
-, int                               nHeight
-)
+void wxWindowOS2::DoSetClientSize( int nWidth,
+                                   int nHeight )
 {
 {
-    POINTL                          vPoint;
-    int                             nActualWidth;
-    int                             nActualHeight;
-    wxWindow*                       pParent = (wxWindow*)GetParent();
-    HWND                            hParentWnd = (HWND)0;
-
-    if (pParent)
-        hParentWnd = (HWND)pParent->GetHWND();
-
-    if (IsKindOf(CLASSINFO(wxFrame)))
-    {
-        wxFrame*                    pFrame = wxDynamicCast(this, wxFrame);
-        HWND                        hFrame = pFrame->GetFrame();
-        RECTL                       vRect;
-        RECTL                       vRect2;
-        RECTL                       vRect3;
-
-        ::WinQueryWindowRect(GetHwnd(), &vRect2);
-        ::WinQueryWindowRect(hFrame, &vRect);
-        ::WinQueryWindowRect(hParentWnd, &vRect3);
-        nActualWidth = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
-        nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
-
-        vPoint.x = vRect2.xLeft;
-        vPoint.y = vRect2.yBottom;
-        if (pParent)
-        {
-            vPoint.x -= vRect3.xLeft;
-            vPoint.y -= vRect3.yBottom;
-        }
-    }
-    else
-    {
-        int                         nX;
-        int                         nY;
+    //
+    // nX & nY assume wxWidgets coordinate system
+    //
+    int nX;
+    int nY;
 
 
-        GetPosition(&nX, &nY);
-        nActualWidth  = nWidth;
-        nActualHeight = nHeight;
+    GetPosition(&nX, &nY);
 
 
-        vPoint.x = nX;
-        vPoint.y = nY;
-    }
-    DoMoveWindow( vPoint.x
-                 ,vPoint.y
-                 ,nActualWidth
-                 ,nActualHeight
-                );
-
-    wxSizeEvent                     vEvent( wxSize( nWidth
-                                                   ,nHeight
-                                                  )
-                                           ,m_windowId
-                                          );
+    DoMoveWindow( nX, nY, nWidth, nHeight );
 
 
+    wxSize size( nWidth, nHeight );
+    wxSizeEvent vEvent( size, m_windowId );
     vEvent.SetEventObject(this);
     vEvent.SetEventObject(this);
-    GetEventHandler()->ProcessEvent(vEvent);
+    HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::DoSetClientSize
 
 } // end of wxWindowOS2::DoSetClientSize
 
-wxPoint wxWindowOS2::GetClientAreaOrigin() const
-{
-    return wxPoint(0, 0);
-} // end of wxWindowOS2::GetClientAreaOrigin
-
 // ---------------------------------------------------------------------------
 // text metrics
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // text metrics
 // ---------------------------------------------------------------------------
@@ -1818,42 +1659,36 @@ int wxWindowOS2::GetCharWidth() const
     return(vFontMetrics.lAveCharWidth);
 } // end of wxWindowOS2::GetCharWidth
 
     return(vFontMetrics.lAveCharWidth);
 } // end of wxWindowOS2::GetCharWidth
 
-void wxWindowOS2::GetTextExtent(
-  const wxString&                   rString
-, int*                              pX
-, int*                              pY
-, int*                              pDescent
-, int*                              pExternalLeading
-, const wxFont*                     pTheFont
-) const
+void wxWindowOS2::DoGetTextExtent( const wxString& rString,
+                                   int* pX,
+                                   int* pY,
+                                   int* pDescent,
+                                   int* pExternalLeading,
+                                   const wxFont* WXUNUSED(pTheFont) ) const
 {
 {
-    POINTL                          avPoint[TXTBOX_COUNT];
-    POINTL                          vPtMin;
-    POINTL                          vPtMax;
-    int                             i;
-    int                             l;
-    FONTMETRICS                     vFM; // metrics structure
-    BOOL                            bRc = FALSE;
-    char*                           pStr;
-    HPS                             hPS;
-
+    POINTL      avPoint[TXTBOX_COUNT];
+    POINTL      vPtMin;
+    POINTL      vPtMax;
+    int         i;
+    int         l;
+    FONTMETRICS vFM; // metrics structure
+    BOOL        bRc = FALSE;
+    HPS         hPS;
 
     hPS = ::WinGetPS(GetHwnd());
 
 
     hPS = ::WinGetPS(GetHwnd());
 
-    l = rString.Length();
+    l = rString.length();
     if (l > 0L)
     {
     if (l > 0L)
     {
-        pStr = (PCH)rString.c_str();
-
         //
         // In world coordinates.
         //
         //
         // In world coordinates.
         //
-        bRc = ::GpiQueryTextBox( hPS
-                                ,l
-                                ,pStr
-                                ,TXTBOX_COUNT // return maximum information
-                                ,avPoint      // array of coordinates points
-                               );
+        bRc = ::GpiQueryTextBox( hPS,
+                                 l,
+                                 (char*) rString.wx_str(),
+                                 TXTBOX_COUNT,// return maximum information
+                                 avPoint      // array of coordinates points
+                                );
         if (bRc)
         {
             vPtMin.x = avPoint[0].x;
         if (bRc)
         {
             vPtMin.x = avPoint[0].x;
@@ -1913,13 +1748,13 @@ void wxWindowOS2::GetTextExtent(
             *pExternalLeading = 0;
     }
     ::WinReleasePS(hPS);
             *pExternalLeading = 0;
     }
     ::WinReleasePS(hPS);
-} // end of wxWindow::GetTextExtent
+} // end of wxWindow::DoGetTextExtent
 
 bool wxWindowOS2::IsMouseInWindow() const
 {
     //
     // Get the mouse position
 
 bool wxWindowOS2::IsMouseInWindow() const
 {
     //
     // Get the mouse position
-    POINTL                          vPt;
+    POINTL vPt;
 
     ::WinQueryPointerPos(HWND_DESKTOP, &vPt);
 
 
     ::WinQueryPointerPos(HWND_DESKTOP, &vPt);
 
@@ -1927,7 +1762,7 @@ bool wxWindowOS2::IsMouseInWindow() const
     // Find the window which currently has the cursor and go up the window
     // chain until we find this window - or exhaust it
     //
     // Find the window which currently has the cursor and go up the window
     // chain until we find this window - or exhaust it
     //
-    HWND                            hWnd = ::WinWindowFromPoint(HWND_DESKTOP, &vPt, TRUE);
+    HWND hWnd = ::WinWindowFromPoint(HWND_DESKTOP, &vPt, TRUE);
 
     while (hWnd && (hWnd != GetHwnd()))
         hWnd = ::WinQueryWindow(hWnd, QW_PARENT);
 
     while (hWnd && (hWnd != GetHwnd()))
         hWnd = ::WinQueryWindow(hWnd, QW_PARENT);
@@ -1941,23 +1776,14 @@ bool wxWindowOS2::IsMouseInWindow() const
 // ---------------------------------------------------------------------------
 //
 #if wxUSE_MENUS_NATIVE
 // ---------------------------------------------------------------------------
 //
 #if wxUSE_MENUS_NATIVE
-bool wxWindowOS2::DoPopupMenu(
-  wxMenu*                           pMenu
-, int                               nX
-, int                               nY
-)
+bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY )
 {
 {
-    HWND                            hWndOwner = GetHwnd();
-    HWND                            hWndParent = GetHwnd();
-    HWND                            hMenu = GetHmenuOf(pMenu);
-    bool                            bIsWaiting = TRUE;
-    int                             nHeight;
+    HWND hWndOwner = GetHwnd();
+    HWND hWndParent = GetHwnd();
+    HWND hMenu = GetHmenuOf(pMenu);
+    bool bIsWaiting = true;
+    int nHeight;
 
 
-    // Protect against recursion
-    if (wxCurrentPopupMenu)
-        return false;
-
-    pMenu->SetInvokingWindow(this);
     pMenu->UpdateUI();
 
     if ( nX == -1 && nY == -1 )
     pMenu->UpdateUI();
 
     if ( nX == -1 && nY == -1 )
@@ -1973,7 +1799,6 @@ bool wxWindowOS2::DoPopupMenu(
         DoGetSize(0,&nHeight);
         nY = nHeight - nY;
     }
         DoGetSize(0,&nHeight);
         nY = nHeight - nY;
     }
-    wxCurrentPopupMenu = pMenu;
 
     ::WinPopupMenu( hWndParent
                    ,hWndOwner
 
     ::WinPopupMenu( hWndParent
                    ,hWndOwner
@@ -1990,13 +1815,11 @@ bool wxWindowOS2::DoPopupMenu(
 
         ::WinGetMsg(vHabmain,&vMsg, (HWND)0, 0, 0);
         if (vMsg.msg == WM_COMMAND)
 
         ::WinGetMsg(vHabmain,&vMsg, (HWND)0, 0, 0);
         if (vMsg.msg == WM_COMMAND)
-            bIsWaiting = FALSE;
+            bIsWaiting = false;
         ::WinDispatchMsg(vHabmain, (PQMSG)&vMsg);
     }
 
         ::WinDispatchMsg(vHabmain, (PQMSG)&vMsg);
     }
 
-    wxCurrentPopupMenu = NULL;
-    pMenu->SetInvokingWindow(NULL);
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::DoPopupMenu
 #endif // wxUSE_MENUS_NATIVE
 
 } // end of wxWindowOS2::DoPopupMenu
 #endif // wxUSE_MENUS_NATIVE
 
@@ -2004,11 +1827,9 @@ bool wxWindowOS2::DoPopupMenu(
 // pre/post message processing
 // ===========================================================================
 
 // pre/post message processing
 // ===========================================================================
 
-MRESULT wxWindowOS2::OS2DefWindowProc(
-  WXUINT                            uMsg
-, WXWPARAM                          wParam
-, WXLPARAM                          lParam
-)
+MRESULT wxWindowOS2::OS2DefWindowProc( WXUINT uMsg,
+                                       WXWPARAM wParam,
+                                       WXLPARAM lParam )
 {
     if (m_fnOldWndProc)
         return (MRESULT)m_fnOldWndProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
 {
     if (m_fnOldWndProc)
         return (MRESULT)m_fnOldWndProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
@@ -2016,9 +1837,7 @@ MRESULT wxWindowOS2::OS2DefWindowProc(
         return ::WinDefWindowProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
 } // end of wxWindowOS2::OS2DefWindowProc
 
         return ::WinDefWindowProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
 } // end of wxWindowOS2::OS2DefWindowProc
 
-bool wxWindowOS2::OS2ProcessMessage(
-  WXMSG*                            pMsg
-)
+bool wxWindowOS2::OS2ProcessMessage( WXMSG* pMsg )
 {
 // wxUniversal implements tab traversal itself
 #ifndef __WXUNIVERSAL__
 {
 // wxUniversal implements tab traversal itself
 #ifndef __WXUNIVERSAL__
@@ -2029,17 +1848,17 @@ bool wxWindowOS2::OS2ProcessMessage(
         //
         // Intercept dialog navigation keys
         //
         //
         // Intercept dialog navigation keys
         //
-        bool                        bProcess = TRUE;
-        USHORT                      uKeyFlags = SHORT1FROMMP(pQMsg->mp1);
+        bool   bProcess = true;
+        USHORT uKeyFlags = SHORT1FROMMP(pQMsg->mp1);
 
         if (uKeyFlags & KC_KEYUP)
 
         if (uKeyFlags & KC_KEYUP)
-            bProcess = FALSE;
+            bProcess = false;
 
         if (uKeyFlags & KC_ALT)
 
         if (uKeyFlags & KC_ALT)
-            bProcess = FALSE;
+            bProcess = false;
 
         if (!(uKeyFlags & KC_VIRTUALKEY))
 
         if (!(uKeyFlags & KC_VIRTUALKEY))
-            bProcess = FALSE;
+            bProcess = false;
 
         if (bProcess)
         {
 
         if (bProcess)
         {
@@ -2058,8 +1877,8 @@ bool wxWindowOS2::OS2ProcessMessage(
                 ulDlgCode = (ULONG)::WinSendMsg(pQMsg->hwnd, WM_QUERYDLGCODE, pQMsg, 0);
             }
 
                 ulDlgCode = (ULONG)::WinSendMsg(pQMsg->hwnd, WM_QUERYDLGCODE, pQMsg, 0);
             }
 
-            bool                    bForward = TRUE;
-            bool                    bWindowChange = FALSE;
+            bool bForward = true;
+            bool bWindowChange = false;
 
             switch (SHORT2FROMMP(pQMsg->mp2))
             {
 
             switch (SHORT2FROMMP(pQMsg->mp2))
             {
@@ -2073,7 +1892,7 @@ bool wxWindowOS2::OS2ProcessMessage(
                     //
                     if (!bShiftDown)
                     {
                     //
                     if (!bShiftDown)
                     {
-                        bProcess = FALSE;
+                        bProcess = false;
                     }
                     else
                     {
                     }
                     else
                     {
@@ -2084,11 +1903,11 @@ bool wxWindowOS2::OS2ProcessMessage(
                         {
                             case DLGC_ENTRYFIELD:
                             case DLGC_MLE:
                         {
                             case DLGC_ENTRYFIELD:
                             case DLGC_MLE:
-                                bProcess = TRUE;
+                                bProcess = true;
                                 break;
 
                             default:
                                 break;
 
                             default:
-                                bProcess = FALSE;
+                                bProcess = false;
                         }
 
                         //
                         }
 
                         //
@@ -2102,15 +1921,15 @@ bool wxWindowOS2::OS2ProcessMessage(
                 case VK_UP:
                 case VK_LEFT:
                     if (bCtrlDown)
                 case VK_UP:
                 case VK_LEFT:
                     if (bCtrlDown)
-                        bProcess = FALSE;
+                        bProcess = false;
                     else
                     else
-                        bForward = FALSE;
+                        bForward = false;
                     break;
 
                 case VK_DOWN:
                 case VK_RIGHT:
                     if (bCtrlDown)
                     break;
 
                 case VK_DOWN:
                 case VK_RIGHT:
                     if (bCtrlDown)
-                        bProcess = FALSE;
+                        bProcess = false;
                     break;
 
                 case VK_ENTER:
                     break;
 
                 case VK_ENTER:
@@ -2120,20 +1939,24 @@ bool wxWindowOS2::OS2ProcessMessage(
                             //
                             // ctrl-enter is not processed
                             //
                             //
                             // ctrl-enter is not processed
                             //
-                            return FALSE;
+                            return false;
                         }
                         else if (ulDlgCode & DLGC_BUTTON)
                         {
                             //
                             // buttons want process Enter themselevs
                             //
                         }
                         else if (ulDlgCode & DLGC_BUTTON)
                         {
                             //
                             // buttons want process Enter themselevs
                             //
-                            bProcess = FALSE;
+                            bProcess = false;
                         }
                         else
                         {
                         }
                         else
                         {
-                            wxButton*   pBtn = wxDynamicCast( GetDefaultItem()
-                                                             ,wxButton
-                                                            );
+                            wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+                            wxButton*   pBtn = NULL;
+
+                            if (tlw)
+                            {
+                                pBtn = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
+                            }
 
                             if (pBtn && pBtn->IsEnabled())
                             {
 
                             if (pBtn && pBtn->IsEnabled())
                             {
@@ -2141,7 +1964,7 @@ bool wxWindowOS2::OS2ProcessMessage(
                                 // If we do have a default button, do press it
                                 //
                                 pBtn->OS2Command(BN_CLICKED, 0 /* unused */);
                                 // If we do have a default button, do press it
                                 //
                                 pBtn->OS2Command(BN_CLICKED, 0 /* unused */);
-                                return TRUE;
+                                return true;
                             }
                             else if (!IsTopLevel())
                             {
                             }
                             else if (!IsTopLevel())
                             {
@@ -2149,7 +1972,7 @@ bool wxWindowOS2::OS2ProcessMessage(
                                 // if not a top level window, let parent
                                 // handle it
                                 //
                                 // if not a top level window, let parent
                                 // handle it
                                 //
-                                return FALSE;
+                                return false;
                             }
                             // else: but if it does not it makes sense to make
                             //       it work like a TAB - and that's what we do.
                             }
                             // else: but if it does not it makes sense to make
                             //       it work like a TAB - and that's what we do.
@@ -2159,7 +1982,7 @@ bool wxWindowOS2::OS2ProcessMessage(
                     break;
 
                 default:
                     break;
 
                 default:
-                    bProcess = FALSE;
+                    bProcess = false;
             }
 
             if (bProcess)
             }
 
             if (bProcess)
@@ -2170,7 +1993,7 @@ bool wxWindowOS2::OS2ProcessMessage(
                 vEvent.SetWindowChange(bWindowChange);
                 vEvent.SetEventObject(this);
 
                 vEvent.SetWindowChange(bWindowChange);
                 vEvent.SetEventObject(this);
 
-                if (GetEventHandler()->ProcessEvent(vEvent))
+                if (HandleWindowEvent(vEvent))
                 {
                     wxButton*       pBtn = wxDynamicCast(FindFocus(), wxButton);
 
                 {
                     wxButton*       pBtn = wxDynamicCast(FindFocus(), wxButton);
 
@@ -2181,7 +2004,7 @@ bool wxWindowOS2::OS2ProcessMessage(
                         //
                         pBtn->SetDefault();
                     }
                         //
                         pBtn->SetDefault();
                     }
-                    return TRUE;
+                    return true;
                 }
             }
         }
                 }
             }
         }
@@ -2189,33 +2012,29 @@ bool wxWindowOS2::OS2ProcessMessage(
         // Let Dialogs process
         //
         if (::WinSendMsg(pQMsg->hwnd, WM_QUERYDLGCODE, pQMsg, 0));
         // Let Dialogs process
         //
         if (::WinSendMsg(pQMsg->hwnd, WM_QUERYDLGCODE, pQMsg, 0));
-            return TRUE;
+            return true;
     }
 #else
     pMsg = pMsg; // just shut up the compiler
 #endif // __WXUNIVERSAL__
 
     }
 #else
     pMsg = pMsg; // just shut up the compiler
 #endif // __WXUNIVERSAL__
 
-    return FALSE;
+    return false;
 } // end of wxWindowOS2::OS2ProcessMessage
 
 } // end of wxWindowOS2::OS2ProcessMessage
 
-bool wxWindowOS2::OS2TranslateMessage(
-  WXMSG*                            pMsg
-)
+bool wxWindowOS2::OS2TranslateMessage( WXMSG* pMsg )
 {
 #if wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
 {
 #if wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
-  return m_acceleratorTable.Translate(m_hWnd, pMsg);
+    return m_acceleratorTable.Translate(m_hWnd, pMsg);
 #else
 #else
-  pMsg = pMsg;
-  return FALSE;
+    pMsg = pMsg;
+    return false;
 #endif //wxUSE_ACCEL
 } // end of wxWindowOS2::OS2TranslateMessage
 
 #endif //wxUSE_ACCEL
 } // end of wxWindowOS2::OS2TranslateMessage
 
-bool wxWindowOS2::OS2ShouldPreProcessMessage(
-  WXMSG*                            pMsg
-)
+bool wxWindowOS2::OS2ShouldPreProcessMessage( WXMSG* WXUNUSED(pMsg) )
 {
     // preprocess all messages by default
 {
     // preprocess all messages by default
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::OS2ShouldPreProcessMessage
 
 // ---------------------------------------------------------------------------
 } // end of wxWindowOS2::OS2ShouldPreProcessMessage
 
 // ---------------------------------------------------------------------------
@@ -2353,17 +2172,15 @@ MRESULT EXPENTRY wxWndProc(
 // We will add (or delete) messages we need to handle at this default
 // level as we go
 //
 // We will add (or delete) messages we need to handle at this default
 // level as we go
 //
-MRESULT wxWindowOS2::OS2WindowProc(
-  WXUINT                            uMsg
-, WXWPARAM                          wParam
-, WXLPARAM                          lParam
-)
+MRESULT wxWindowOS2::OS2WindowProc( WXUINT uMsg,
+                                    WXWPARAM wParam,
+                                    WXLPARAM lParam )
 {
     //
     // Did we process the uMsg?
     //
 {
     //
     // Did we process the uMsg?
     //
-    bool                            bProcessed = FALSE;
-    MRESULT                         mResult;
+    bool bProcessed = false;
+    MRESULT mResult;
 
     //
     // For most messages we should return 0 when we do process the message
 
     //
     // For most messages we should return 0 when we do process the message
@@ -2391,7 +2208,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
 
         case WM_DESTROY:
              HandleDestroy();
 
         case WM_DESTROY:
              HandleDestroy();
-             bProcessed = TRUE;
+             bProcessed = true;
              break;
 
         case WM_MOVE:
              break;
 
         case WM_MOVE:
@@ -2459,7 +2276,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                 bProcessed = HandleActivate( wState
                                             ,(WXHWND)hWnd
                                            );
                 bProcessed = HandleActivate( wState
                                             ,(WXHWND)hWnd
                                            );
-                bProcessed = FALSE;
+                bProcessed = false;
             }
             break;
 
             }
             break;
 
@@ -2479,7 +2296,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
             // Don't let the DefWindowProc() destroy our window - we'll do it
             // ourselves in ~wxWindow
             //
             // Don't let the DefWindowProc() destroy our window - we'll do it
             // ourselves in ~wxWindow
             //
-            bProcessed = TRUE;
+            bProcessed = true;
             mResult = (MRESULT)TRUE;
             break;
 
             mResult = (MRESULT)TRUE;
             break;
 
@@ -2508,9 +2325,6 @@ MRESULT wxWindowOS2::OS2WindowProc(
         case WM_BUTTON3MOTIONEND:
         case WM_BUTTON3MOTIONSTART:
             {
         case WM_BUTTON3MOTIONEND:
         case WM_BUTTON3MOTIONSTART:
             {
-                if (uMsg == WM_BUTTON1DOWN && AcceptsFocus())
-                    SetFocus();
-
                 short               nX = LOWORD(wParam);
                 short               nY = HIWORD(wParam);
 
                 short               nX = LOWORD(wParam);
                 short               nY = HIWORD(wParam);
 
@@ -2533,7 +2347,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                                                                   );
                     if (!pWin->IsOfStandardClass())
                     {
                                                                   );
                     if (!pWin->IsOfStandardClass())
                     {
-                        if (uMsg == WM_BUTTON1DOWN && pWin->AcceptsFocus() )
+                        if (uMsg == WM_BUTTON1DOWN && pWin->CanAcceptFocus() )
                             pWin->SetFocus();
                     }
                     bProcessed = pWin->HandleMouseEvent( uMsg
                             pWin->SetFocus();
                     }
                     bProcessed = pWin->HandleMouseEvent( uMsg
@@ -2590,7 +2404,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                 if ( m_lDlgCode )
                 {
                     mResult = (MRESULT)m_lDlgCode;
                 if ( m_lDlgCode )
                 {
                     mResult = (MRESULT)m_lDlgCode;
-                    bProcessed = TRUE;
+                    bProcessed = true;
                 }
             }
             //
                 }
             }
             //
@@ -2614,7 +2428,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                 }
                 else // keydown event
                 {
                 }
                 else // keydown event
                 {
-                    m_bLastKeydownProcessed = FALSE;
+                    m_bLastKeydownProcessed = false;
                     //
                     // If this has been processed by an event handler,
                     // return 0 now (we've handled it). DON't RETURN
                     //
                     // If this has been processed by an event handler,
                     // return 0 now (we've handled it). DON't RETURN
@@ -2636,7 +2450,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             case VK_CAPSLOCK:
                             case VK_NUMLOCK:
                             case VK_SCRLLOCK:
                             case VK_CAPSLOCK:
                             case VK_NUMLOCK:
                             case VK_SCRLLOCK:
-                                bProcessed = TRUE;
+                                bProcessed = true;
                                 break;
 
                             // Avoid duplicate messages to OnChar for these ASCII keys: they
                                 break;
 
                             // Avoid duplicate messages to OnChar for these ASCII keys: they
@@ -2645,10 +2459,10 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             case VK_ENTER:
                             case VK_BACKSPACE:
                             case VK_TAB:
                             case VK_ENTER:
                             case VK_BACKSPACE:
                             case VK_TAB:
-                                // But set processed to FALSE, not TRUE to still pass them to
+                                // But set processed to false, not true to still pass them to
                                 // the control's default window proc - otherwise built-in
                                 // keyboard handling won't work
                                 // the control's default window proc - otherwise built-in
                                 // keyboard handling won't work
-                                bProcessed = FALSE;
+                                bProcessed = false;
                                 break;
 
                             default:
                                 break;
 
                             default:
@@ -2665,12 +2479,12 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             // a key in an EVT_KEY_DOWN handler is meant, by
                             // design, to prevent EVT_CHARs from happening
                             //
                             // a key in an EVT_KEY_DOWN handler is meant, by
                             // design, to prevent EVT_CHARs from happening
                             //
-                            m_bLastKeydownProcessed = FALSE;
-                            bProcessed = TRUE;
+                            m_bLastKeydownProcessed = false;
+                            bProcessed = true;
                         }
                         else // do generate a CHAR event
                         {
                         }
                         else // do generate a CHAR event
                         {
-                            bProcessed = HandleChar(wParam, lParam, TRUE);
+                            bProcessed = HandleChar(wParam, lParam, true);
                             break;
                         }
                     }
                             break;
                         }
                     }
@@ -2709,7 +2523,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
 
                         if (!pWin)
                         {
 
                         if (!pWin)
                         {
-                            bProcessed = FALSE;
+                            bProcessed = false;
                             break;
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxBitmapButton)))
                             break;
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxBitmapButton)))
@@ -2720,7 +2534,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                         }
                         return 0;
                     }
                         }
                         return 0;
                     }
-                    break;
+                    // break;
 
                 case BKN_PAGESELECTEDPENDING:
                     {
 
                 case BKN_PAGESELECTEDPENDING:
                     {
@@ -2730,14 +2544,14 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
                         {
                             wxWindowOS2*        pWin = wxFindWinFromHandle(pPage->hwndBook);
                             (pPage->ulPageIdNew > 0L && pPage->ulPageIdCur > 0L))
                         {
                             wxWindowOS2*        pWin = wxFindWinFromHandle(pPage->hwndBook);
-                            wxNotebookEvent     vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
+                            wxBookCtrlEvent     vEvent( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
                                                        ,(int)SHORT1FROMMP(wParam)
                                                        ,(int)pPage->ulPageIdNew
                                                        ,(int)pPage->ulPageIdCur
                                                       );
                             if (!pWin)
                             {
                                                        ,(int)SHORT1FROMMP(wParam)
                                                        ,(int)pPage->ulPageIdNew
                                                        ,(int)pPage->ulPageIdCur
                                                       );
                             if (!pWin)
                             {
-                                bProcessed = FALSE;
+                                bProcessed = false;
                                 break;
                             }
                             if (pWin->IsKindOf(CLASSINFO(wxNotebook)))
                                 break;
                             }
                             if (pWin->IsKindOf(CLASSINFO(wxNotebook)))
@@ -2746,16 +2560,17 @@ MRESULT wxWindowOS2::OS2WindowProc(
 
                                 vEvent.SetEventObject(pWin);
                                 pNotebook->OnSelChange(vEvent);
 
                                 vEvent.SetEventObject(pWin);
                                 pNotebook->OnSelChange(vEvent);
-                                bProcessed = TRUE;
+                                bProcessed = true;
                             }
                             else
                             }
                             else
-                                bProcessed = FALSE;
+                                bProcessed = false;
                         }
                         else
                         }
                         else
-                            bProcessed = FALSE;
+                            bProcessed = false;
                     }
                     break;
 
                     }
                     break;
 
+                case CBN_LBSELECT:
                 case BN_CLICKED: // Dups as LN_SELECT and CBN_LBSELECT
                     {
                         HWND                hWnd = ::WinWindowFromID((HWND)GetHwnd(), SHORT1FROMMP(wParam));
                 case BN_CLICKED: // Dups as LN_SELECT and CBN_LBSELECT
                     {
                         HWND                hWnd = ::WinWindowFromID((HWND)GetHwnd(), SHORT1FROMMP(wParam));
@@ -2763,7 +2578,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
 
                         if (!pWin)
                         {
 
                         if (!pWin)
                         {
-                            bProcessed = FALSE;
+                            bProcessed = false;
                             break;
                         }
                         //
                             break;
                         }
                         //
@@ -2775,7 +2590,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             wxRadioBox*         pRadioBox = wxDynamicCast(pWin, wxRadioBox);
 
                             pRadioBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
                             wxRadioBox*         pRadioBox = wxDynamicCast(pWin, wxRadioBox);
 
                             pRadioBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
-                                                  ,(WXUINT)SHORT1FROMMP(wParam)
+                                                  ,(WXWORD)SHORT1FROMMP(wParam)
                                                  );
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxRadioButton)))
                                                  );
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxRadioButton)))
@@ -2783,7 +2598,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             wxRadioButton*      pRadioButton = wxDynamicCast(pWin, wxRadioButton);
 
                             pRadioButton->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
                             wxRadioButton*      pRadioButton = wxDynamicCast(pWin, wxRadioButton);
 
                             pRadioButton->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
-                                                     ,(WXUINT)SHORT1FROMMP(wParam)
+                                                     ,(WXWORD)SHORT1FROMMP(wParam)
                                                     );
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxCheckBox)))
                                                     );
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxCheckBox)))
@@ -2791,7 +2606,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             wxCheckBox*         pCheckBox = wxDynamicCast(pWin, wxCheckBox);
 
                             pCheckBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
                             wxCheckBox*         pCheckBox = wxDynamicCast(pWin, wxCheckBox);
 
                             pCheckBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
-                                                  ,(WXUINT)SHORT1FROMMP(wParam)
+                                                  ,(WXWORD)SHORT1FROMMP(wParam)
                                                  );
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxListBox)))
                                                  );
                         }
                         if (pWin->IsKindOf(CLASSINFO(wxListBox)))
@@ -2799,7 +2614,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             wxListBox*          pListBox = wxDynamicCast(pWin, wxListBox);
 
                             pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
                             wxListBox*          pListBox = wxDynamicCast(pWin, wxListBox);
 
                             pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
-                                                 ,(WXUINT)SHORT1FROMMP(wParam)
+                                                 ,(WXWORD)SHORT1FROMMP(wParam)
                                                 );
                             if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
                                 Refresh();
                                                 );
                             if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
                                 Refresh();
@@ -2809,21 +2624,29 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             wxComboBox*          pComboBox = wxDynamicCast(pWin, wxComboBox);
 
                             pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
                             wxComboBox*          pComboBox = wxDynamicCast(pWin, wxComboBox);
 
                             pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
-                                                  ,(WXUINT)SHORT1FROMMP(wParam)
+                                                  ,(WXWORD)SHORT1FROMMP(wParam)
                                                  );
                         }
                                                  );
                         }
+                        if (pWin->IsKindOf(CLASSINFO(wxChoice)))
+                        {
+                            wxChoice*           pChoice = wxDynamicCast(pWin, wxChoice);
+
+                            pChoice->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
+                                                ,(WXWORD)SHORT1FROMMP(wParam)
+                                               );
+                        }
                         return 0;
                     }
                         return 0;
                     }
-                    break;
+                    // break;
 
 
-                case LN_ENTER:   /* dups as CBN_EFCHANGE */
+                case LN_ENTER:
                     {
                         HWND                hWnd = HWNDFROMMP(lParam);
                         wxWindowOS2*        pWin = wxFindWinFromHandle(hWnd);
 
                         if (!pWin)
                         {
                     {
                         HWND                hWnd = HWNDFROMMP(lParam);
                         wxWindowOS2*        pWin = wxFindWinFromHandle(hWnd);
 
                         if (!pWin)
                         {
-                            bProcessed = FALSE;
+                            bProcessed = false;
                             break;
                         }
                         //
                             break;
                         }
                         //
@@ -2835,7 +2658,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             wxListBox*          pListBox = wxDynamicCast(pWin, wxListBox);
 
                             pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
                             wxListBox*          pListBox = wxDynamicCast(pWin, wxListBox);
 
                             pListBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
-                                                 ,(WXUINT)SHORT1FROMMP(wParam)
+                                                 ,(WXWORD)SHORT1FROMMP(wParam)
                                                 );
                             if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
                                 Refresh();
                                                 );
                             if (pListBox->GetWindowStyle() & wxLB_OWNERDRAW)
                                 Refresh();
@@ -2846,31 +2669,31 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             wxComboBox*          pComboBox = wxDynamicCast(pWin, wxComboBox);
 
                             pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
                             wxComboBox*          pComboBox = wxDynamicCast(pWin, wxComboBox);
 
                             pComboBox->OS2Command( (WXUINT)SHORT2FROMMP(wParam)
-                                                  ,(WXUINT)SHORT1FROMMP(wParam)
+                                                  ,(WXWORD)SHORT1FROMMP(wParam)
                                                  );
                         }
                         return 0;
                     }
                                                  );
                         }
                         return 0;
                     }
-                    break;
+                    // break;
 
                 case SPBN_UPARROW:
                 case SPBN_DOWNARROW:
                 case SPBN_CHANGE:
                     {
 
                 case SPBN_UPARROW:
                 case SPBN_DOWNARROW:
                 case SPBN_CHANGE:
                     {
-                        char        zVal[10];
-                        long        lVal;
+                        char zVal[10];
+                        long lVal;
 
                         ::WinSendMsg( HWNDFROMMP(lParam)
                                      ,SPBM_QUERYVALUE
 
                         ::WinSendMsg( HWNDFROMMP(lParam)
                                      ,SPBM_QUERYVALUE
-                                     ,&zVal
+                                     ,&zVal[0]
                                      ,MPFROM2SHORT( (USHORT)10
                                                    ,(USHORT)SPBQ_UPDATEIFVALID
                                                   )
                                     );
                         lVal = atol(zVal);
                         bProcessed = OS2OnScroll( wxVERTICAL
                                      ,MPFROM2SHORT( (USHORT)10
                                                    ,(USHORT)SPBQ_UPDATEIFVALID
                                                   )
                                     );
                         lVal = atol(zVal);
                         bProcessed = OS2OnScroll( wxVERTICAL
-                                                 ,(int)SHORT2FROMMP(wParam)
-                                                 ,(int)lVal
+                                                 ,(WXWORD)SHORT2FROMMP(wParam)
+                                                 ,(WXWORD)lVal
                                                  ,HWNDFROMMP(lParam)
                                                 );
                     }
                                                  ,HWNDFROMMP(lParam)
                                                 );
                     }
@@ -2878,18 +2701,18 @@ MRESULT wxWindowOS2::OS2WindowProc(
 
                 case SLN_SLIDERTRACK:
                     {
 
                 case SLN_SLIDERTRACK:
                     {
-                        HWND                hWnd = ::WinWindowFromID(GetHWND(), SHORT1FROMMP(wParam));
-                        wxWindowOS2*        pChild = wxFindWinFromHandle(hWnd);
+                        HWND         hWnd = ::WinWindowFromID(GetHWND(), SHORT1FROMMP(wParam));
+                        wxWindowOS2* pChild = wxFindWinFromHandle(hWnd);
 
                         if (!pChild)
                         {
 
                         if (!pChild)
                         {
-                            bProcessed = FALSE;
+                            bProcessed = false;
                             break;
                         }
                         if (pChild->IsKindOf(CLASSINFO(wxSlider)))
                             bProcessed = OS2OnScroll( wxVERTICAL
                             break;
                         }
                         if (pChild->IsKindOf(CLASSINFO(wxSlider)))
                             bProcessed = OS2OnScroll( wxVERTICAL
-                                                     ,(int)SHORT2FROMMP(wParam)
-                                                     ,(int)LONGFROMMP(lParam)
+                                                     ,(WXWORD)SHORT2FROMMP(wParam)
+                                                     ,(WXWORD)LONGFROMMP(lParam)
                                                      ,hWnd
                                                     );
                     }
                                                      ,hWnd
                                                     );
                     }
@@ -2995,15 +2818,17 @@ MRESULT wxWindowOS2::OS2WindowProc(
     return mResult;
 } // end of wxWindowOS2::OS2WindowProc
 
     return mResult;
 } // end of wxWindowOS2::OS2WindowProc
 
+// ----------------------------------------------------------------------------
+// wxWindow <-> HWND map
+// ----------------------------------------------------------------------------
+
+wxWinHashTable *wxWinHandleHash = NULL;
+
 wxWindow* wxFindWinFromHandle(
   WXHWND                            hWnd
 )
 {
 wxWindow* wxFindWinFromHandle(
   WXHWND                            hWnd
 )
 {
-    wxNode*                         pNode = wxWinHandleList->Find((long)hWnd);
-
-    if (!pNode)
-        return NULL;
-    return (wxWindow *)pNode->GetData();
+    return (wxWindow *)wxWinHandleHash->Get((long)hWnd);
 } // end of wxFindWinFromHandle
 
 void wxAssociateWinWithHandle(
 } // end of wxFindWinFromHandle
 
 void wxAssociateWinWithHandle(
@@ -3018,30 +2843,29 @@ void wxAssociateWinWithHandle(
     wxCHECK_RET( hWnd != (HWND)NULL,
                  wxT("attempt to add a NULL hWnd to window list ignored") );
 
     wxCHECK_RET( hWnd != (HWND)NULL,
                  wxT("attempt to add a NULL hWnd to window list ignored") );
 
-
     wxWindow*                       pOldWin = wxFindWinFromHandle((WXHWND) hWnd);
 
     if (pOldWin && (pOldWin != pWin))
     {
     wxWindow*                       pOldWin = wxFindWinFromHandle((WXHWND) hWnd);
 
     if (pOldWin && (pOldWin != pWin))
     {
-        wxString                    str(pWin->GetClassInfo()->GetClassName());
-        wxLogError( "Bug! Found existing HWND %X for new window of class %s"
-                   ,(int)hWnd
-                   ,(const char*)str
+        wxString  Newstr(pWin->GetClassInfo()->GetClassName());
+        wxString Oldstr(pOldWin->GetClassInfo()->GetClassName());
+        wxLogError( wxT("Bug! New window of class %s has same HWND %X as old window of class %s"),
+                    Newstr.c_str(),
+                    (int)hWnd,
+                    Oldstr.c_str()
                   );
     }
     else if (!pOldWin)
     {
                   );
     }
     else if (!pOldWin)
     {
-        wxWinHandleList->Append( (long)hWnd
-                                ,pWin
-                               );
+        wxWinHandleHash->Put( (long)hWnd
+                             ,(wxWindow *)pWin
+                            );
     }
 } // end of wxAssociateWinWithHandle
 
     }
 } // end of wxAssociateWinWithHandle
 
-void wxRemoveHandleAssociation(
-  wxWindowOS2*                      pWin
-)
+void wxRemoveHandleAssociation( wxWindowOS2* pWin )
 {
 {
-    wxWinHandleList->DeleteObject(pWin);
+    wxWinHandleHash->Delete((long)pWin->GetHWND());
 } // end of wxRemoveHandleAssociation
 
 //
 } // end of wxRemoveHandleAssociation
 
 //
@@ -3052,38 +2876,36 @@ void wxWindowOS2::OS2DestroyWindow()
 {
 }
 
 {
 }
 
-bool wxWindowOS2::OS2GetCreateWindowCoords(
-  const wxPoint&                    rPos
-, const wxSize&                     rSize
-, int&                              rnX
-, int&                              rnY
-, int&                              rnWidth
-, int&                              rnHeight
-) const
+bool wxWindowOS2::OS2GetCreateWindowCoords( const wxPoint& rPos,
+                                            const wxSize&  rSize,
+                                            int& rnX,
+                                            int& rnY,
+                                            int& rnWidth,
+                                            int& rnHeight ) const
 {
 {
-    bool                            bNonDefault = FALSE;
-    static const int                DEFAULT_Y = 200;
-    static const int                DEFAULT_H = 250;
+    bool bNonDefault = false;
+    static const int DEFAULT_Y = 200;
+    static const int DEFAULT_H = 250;
 
 
-    if (rPos.x == -1)
+    if (rPos.x == wxDefaultCoord)
     {
         rnX = rnY = CW_USEDEFAULT;
     }
     else
     {
         rnX = rPos.x;
     {
         rnX = rnY = CW_USEDEFAULT;
     }
     else
     {
         rnX = rPos.x;
-        rnY = rPos.y == -1 ? DEFAULT_Y : rPos.y;
-        bNonDefault = TRUE;
+        rnY = rPos.y == wxDefaultCoord ? DEFAULT_Y : rPos.y;
+        bNonDefault = true;
     }
     }
-    if (rSize.x == -1)
+    if (rSize.x == wxDefaultCoord)
     {
         rnWidth = rnHeight = CW_USEDEFAULT;
     }
     else
     {
         rnWidth  = rSize.x;
     {
         rnWidth = rnHeight = CW_USEDEFAULT;
     }
     else
     {
         rnWidth  = rSize.x;
-        rnHeight = rSize.y == -1 ? DEFAULT_H : rSize.y;
-        bNonDefault = TRUE;
+        rnHeight = rSize.y == wxDefaultCoord ? DEFAULT_H : rSize.y;
+        bNonDefault = true;
     }
     return bNonDefault;
 } // end of wxWindowOS2::OS2GetCreateWindowCoords
     }
     return bNonDefault;
 } // end of wxWindowOS2::OS2GetCreateWindowCoords
@@ -3093,26 +2915,25 @@ WXHWND wxWindowOS2::OS2GetParent() const
     return m_parent ? m_parent->GetHWND() : NULL;
 }
 
     return m_parent ? m_parent->GetHWND() : NULL;
 }
 
-bool wxWindowOS2::OS2Create(
-  PSZ                               zClass
-, const char*                       zTitle
-, WXDWORD                           dwStyle
-, const wxPoint&                    rPos
-, const wxSize&                     rSize
-, void*                             pCtlData
-, WXDWORD                           dwExStyle
-, bool                              bIsChild
-)
+bool wxWindowOS2::OS2Create( PSZ            zClass,
+                             const wxChar*  zTitle,
+                             WXDWORD        dwStyle,
+                             const wxPoint& rPos,
+                             const wxSize&  rSize,
+                             void*          pCtlData,
+                             WXDWORD        WXUNUSED(dwExStyle),
+                             bool           bIsChild )
 {
 {
-    ERRORID                         vError;
-    wxString                        sError;
-    int                             nX      = 0L;
-    int                             nY      = 0L;
-    int                             nWidth  = 0L;
-    int                             nHeight = 0L;
-    long                            lControlId = 0L;
-    wxWindowCreationHook            vHook(this);
-    wxString                        sClassName((wxChar*)zClass);
+    ERRORID              vError;
+    wxString             sError;
+    int                  nX      = 0L;
+    int                  nY      = 0L;
+    int                  nWidth  = 0L;
+    int                  nHeight = 0L;
+    long                 lControlId = 0L;
+    wxWindowCreationHook vHook(this);
+    wxString             sClassName((wxChar*)zClass);
+    wxString             sTitle(zTitle ? zTitle : wxEmptyString);
 
     OS2GetCreateWindowCoords( rPos
                              ,rSize
 
     OS2GetCreateWindowCoords( rPos
                              ,rSize
@@ -3140,8 +2961,8 @@ bool wxWindowOS2::OS2Create(
         sClassName += wxT("NR");
     }
     m_hWnd = (WXHWND)::WinCreateWindow( (HWND)OS2GetParent()
         sClassName += wxT("NR");
     }
     m_hWnd = (WXHWND)::WinCreateWindow( (HWND)OS2GetParent()
-                                       ,(PSZ)sClassName.c_str()
-                                       ,(PSZ)zTitle ? zTitle : ""
+                                       ,sClassName.c_str()
+                                       ,sTitle.c_str()
                                        ,(ULONG)dwStyle
                                        ,(LONG)0L
                                        ,(LONG)0L
                                        ,(ULONG)dwStyle
                                        ,(LONG)0L
                                        ,(LONG)0L
@@ -3157,14 +2978,14 @@ bool wxWindowOS2::OS2Create(
     {
         vError = ::WinGetLastError(wxGetInstance());
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(wxGetInstance());
         sError = wxPMErrorToStr(vError);
-        return FALSE;
+        return false;
     }
     SubclassWin(m_hWnd);
     SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
 
     }
     SubclassWin(m_hWnd);
     SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
 
-    m_backgroundColour.Set(wxString("GREY"));
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
 
 
-    LONG                            lColor = (LONG)m_backgroundColour.GetPixel();
+    LONG lColor = (LONG)m_backgroundColour.GetPixel();
 
     if (!::WinSetPresParam( m_hWnd
                            ,PP_BACKGROUNDCOLOR
 
     if (!::WinSetPresParam( m_hWnd
                            ,PP_BACKGROUNDCOLOR
@@ -3174,16 +2995,16 @@ bool wxWindowOS2::OS2Create(
     {
         vError = ::WinGetLastError(vHabmain);
         sError = wxPMErrorToStr(vError);
     {
         vError = ::WinGetLastError(vHabmain);
         sError = wxPMErrorToStr(vError);
-        wxLogError("Error creating frame. Error: %s\n", sError.c_str());
-        return FALSE;
+        wxLogError(wxT("Error creating frame. Error: %s\n"), sError.c_str());
+        return false;
     }
     SetSize( nX
             ,nY
             ,nWidth
             ,nHeight
            );
     }
     SetSize( nX
             ,nY
             ,nWidth
             ,nHeight
            );
-    return TRUE;
-} // end of WinGuiBase_Window::OS2Create
+    return true;
+} // end of wxWindowOS2::OS2Create
 
 // ===========================================================================
 // OS2 PM message handlers
 
 // ===========================================================================
 // OS2 PM message handlers
@@ -3193,39 +3014,33 @@ bool wxWindowOS2::OS2Create(
 // window creation/destruction
 // ---------------------------------------------------------------------------
 
 // window creation/destruction
 // ---------------------------------------------------------------------------
 
-bool wxWindowOS2::HandleCreate(
-  WXLPCREATESTRUCT                  WXUNUSED(vCs)
-, bool*                             pbMayCreate
-)
+bool wxWindowOS2::HandleCreate( WXLPCREATESTRUCT WXUNUSED(vCs),
+                                bool* pbMayCreate )
 {
     wxWindowCreateEvent             vEvent((wxWindow*)this);
 
 {
     wxWindowCreateEvent             vEvent((wxWindow*)this);
 
-    (void)GetEventHandler()->ProcessEvent(vEvent);
-    *pbMayCreate = TRUE;
-    return TRUE;
+    (void)HandleWindowEvent(vEvent);
+    *pbMayCreate = true;
+    return true;
 } // end of wxWindowOS2::HandleCreate
 
 bool wxWindowOS2::HandleDestroy()
 {
     wxWindowDestroyEvent            vEvent((wxWindow*)this);
     vEvent.SetId(GetId());
 } // end of wxWindowOS2::HandleCreate
 
 bool wxWindowOS2::HandleDestroy()
 {
     wxWindowDestroyEvent            vEvent((wxWindow*)this);
     vEvent.SetId(GetId());
-    (void)GetEventHandler()->ProcessEvent(vEvent);
+    (void)HandleWindowEvent(vEvent);
 
     //
     // Delete our drop target if we've got one
     //
 #if wxUSE_DRAG_AND_DROP
 
     //
     // Delete our drop target if we've got one
     //
 #if wxUSE_DRAG_AND_DROP
-    if (m_dropTarget != NULL)
-    {
-        delete m_dropTarget;
-        m_dropTarget = NULL;
-    }
+    wxDELETE(m_dropTarget);
 #endif // wxUSE_DRAG_AND_DROP
 
     //
     // WM_DESTROY handled
     //
 #endif // wxUSE_DRAG_AND_DROP
 
     //
     // WM_DESTROY handled
     //
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::HandleDestroy
 
 // ---------------------------------------------------------------------------
 } // end of wxWindowOS2::HandleDestroy
 
 // ---------------------------------------------------------------------------
@@ -3248,19 +3063,17 @@ bool wxWindowOS2::HandleActivate(
                                            ,m_windowId
                                           );
     vEvent.SetEventObject(this);
                                            ,m_windowId
                                           );
     vEvent.SetEventObject(this);
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleActivate
 
 } // end of wxWindowOS2::HandleActivate
 
-bool wxWindowOS2::HandleSetFocus(
-  WXHWND                            WXUNUSED(hWnd)
-)
+bool wxWindowOS2::HandleSetFocus( WXHWND WXUNUSED(hWnd) )
 {
     //
     // Notify the parent keeping track of focus for the kbd navigation
     // purposes that we got it
     //
     wxChildFocusEvent               vEventFocus((wxWindow *)this);
 {
     //
     // Notify the parent keeping track of focus for the kbd navigation
     // purposes that we got it
     //
     wxChildFocusEvent               vEventFocus((wxWindow *)this);
-    (void)GetEventHandler()->ProcessEvent(vEventFocus);
+    (void)HandleWindowEvent(vEventFocus);
 
 #if wxUSE_CARET
     //
 
 #if wxUSE_CARET
     //
@@ -3277,19 +3090,17 @@ bool wxWindowOS2::HandleSetFocus(
     // after the control gets to process it from EN_FOCUS handler
     if ( wxDynamicCastThis(wxTextCtrl) )
     {
     // after the control gets to process it from EN_FOCUS handler
     if ( wxDynamicCastThis(wxTextCtrl) )
     {
-        return FALSE;
+        return false;
     }
 #endif // wxUSE_TEXTCTRL
 
     wxFocusEvent                    vEvent(wxEVT_SET_FOCUS, m_windowId);
 
     vEvent.SetEventObject(this);
     }
 #endif // wxUSE_TEXTCTRL
 
     wxFocusEvent                    vEvent(wxEVT_SET_FOCUS, m_windowId);
 
     vEvent.SetEventObject(this);
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleSetFocus
 
 } // end of wxWindowOS2::HandleSetFocus
 
-bool wxWindowOS2::HandleKillFocus(
-  WXHWND                            hWnd
-)
+bool wxWindowOS2::HandleKillFocus( WXHWND hWnd )
 {
 #if wxUSE_CARET
     //
 {
 #if wxUSE_CARET
     //
@@ -3310,7 +3121,7 @@ bool wxWindowOS2::HandleKillFocus(
 
     if (pCtrl)
     {
 
     if (pCtrl)
     {
-        return FALSE;
+        return false;
     }
 #endif
 
     }
 #endif
 
@@ -3320,7 +3131,7 @@ bool wxWindowOS2::HandleKillFocus(
     //
     if ( m_isBeingDeleted )
     {
     //
     if ( m_isBeingDeleted )
     {
-        return FALSE;
+        return false;
     }
 
     wxFocusEvent                    vEvent( wxEVT_KILL_FOCUS
     }
 
     wxFocusEvent                    vEvent( wxEVT_KILL_FOCUS
@@ -3333,7 +3144,7 @@ bool wxWindowOS2::HandleKillFocus(
     // wxFindWinFromHandle() may return NULL, it is ok
     //
     vEvent.SetWindow(wxFindWinFromHandle(hWnd));
     // wxFindWinFromHandle() may return NULL, it is ok
     //
     vEvent.SetWindow(wxFindWinFromHandle(hWnd));
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleKillFocus
 
 // ---------------------------------------------------------------------------
 } // end of wxWindowOS2::HandleKillFocus
 
 // ---------------------------------------------------------------------------
@@ -3347,49 +3158,43 @@ bool wxWindowOS2::HandleShow(
 {
     wxShowEvent                     vEvent(GetId(), bShow);
 
 {
     wxShowEvent                     vEvent(GetId(), bShow);
 
-    vEvent.m_eventObject = this;
-    return GetEventHandler()->ProcessEvent(vEvent);
+    vEvent.SetEventObject(this);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleShow
 
 } // end of wxWindowOS2::HandleShow
 
-bool wxWindowOS2::HandleInitDialog(
-  WXHWND                            WXUNUSED(hWndFocus)
-)
+bool wxWindowOS2::HandleInitDialog( WXHWND WXUNUSED(hWndFocus) )
 {
     wxInitDialogEvent               vEvent(GetId());
 
 {
     wxInitDialogEvent               vEvent(GetId());
 
-    vEvent.m_eventObject = this;
-    return GetEventHandler()->ProcessEvent(vEvent);
+    vEvent.SetEventObject(this);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleInitDialog
 
 bool wxWindowOS2::HandleEndDrag(WXWPARAM WXUNUSED(wParam))
 {
    // TODO: We'll handle drag and drop later
 } // end of wxWindowOS2::HandleInitDialog
 
 bool wxWindowOS2::HandleEndDrag(WXWPARAM WXUNUSED(wParam))
 {
    // TODO: We'll handle drag and drop later
-    return FALSE;
+    return false;
 }
 
 }
 
-bool wxWindowOS2::HandleSetCursor(
-  USHORT                            WXUNUSED(vId)
-, WXHWND                            hPointer
-)
+bool wxWindowOS2::HandleSetCursor( USHORT WXUNUSED(vId),
+                                   WXHWND hPointer )
 {
     //
     // Under OS/2 PM this allows the pointer to be changed
     // as it passes over a control
     //
     ::WinSetPointer(HWND_DESKTOP, (HPOINTER)hPointer);
 {
     //
     // Under OS/2 PM this allows the pointer to be changed
     // as it passes over a control
     //
     ::WinSetPointer(HWND_DESKTOP, (HPOINTER)hPointer);
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::HandleSetCursor
 
 // ---------------------------------------------------------------------------
 // owner drawn stuff
 // ---------------------------------------------------------------------------
 } // end of wxWindowOS2::HandleSetCursor
 
 // ---------------------------------------------------------------------------
 // owner drawn stuff
 // ---------------------------------------------------------------------------
-bool wxWindowOS2::OS2OnDrawItem(
-  int                               vId
-, WXDRAWITEMSTRUCT*                 pItemStruct
-)
+bool wxWindowOS2::OS2OnDrawItem( int vId,
+                                 WXDRAWITEMSTRUCT* pItemStruct )
 {
 #if wxUSE_OWNER_DRAWN
 {
 #if wxUSE_OWNER_DRAWN
-    wxDC                            vDc;
+    wxClientDC                      vDc(this);
 
 #if wxUSE_MENUS_NATIVE
     //
 
 #if wxUSE_MENUS_NATIVE
     //
@@ -3408,10 +3213,10 @@ bool wxWindowOS2::OS2OnDrawItem(
                                           ,pMeasureStruct->rclItem.xRight - pMeasureStruct->rclItem.xLeft
                                           ,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom
                                          );
                                           ,pMeasureStruct->rclItem.xRight - pMeasureStruct->rclItem.xLeft
                                           ,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom
                                          );
-        vDc.SetHDC( hDC
-                   ,FALSE
-                  );
-        vDc.SetHPS(pMeasureStruct->hps);
+
+        wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
+        impl->SetHDC( hDC, false );
+        impl->SetHPS( pMeasureStruct->hps );
         //
         // Load the wxWidgets Pallete and set to RGB mode
         //
         //
         // Load the wxWidgets Pallete and set to RGB mode
         //
@@ -3425,7 +3230,7 @@ bool wxWindowOS2::OS2OnDrawItem(
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
-            wxLogError("Unable to set current color table. Error: %s\n", sError.c_str());
+            wxLogError(wxT("Unable to set current color table (1). Error: %s\n"), sError.c_str());
         }
         //
         // Set the color table to RGB mode
         }
         //
         // Set the color table to RGB mode
@@ -3440,14 +3245,13 @@ bool wxWindowOS2::OS2OnDrawItem(
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
         {
             vError = ::WinGetLastError(vHabmain);
             sError = wxPMErrorToStr(vError);
-            wxLogError("Unable to set current color table. Error: %s\n", sError.c_str());
+            wxLogError(wxT("Unable to set current color table (2). Error: %s\n"), sError.c_str());
         }
 
         wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
 
         }
 
         wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
 
-
-        int                         eAction = 0;
-        int                         eStatus = 0;
+        int eAction = 0;
+        int eStatus = 0;
 
         if (pMeasureStruct->fsAttribute == pMeasureStruct->fsAttributeOld)
         {
 
         if (pMeasureStruct->fsAttribute == pMeasureStruct->fsAttributeOld)
         {
@@ -3509,7 +3313,7 @@ bool wxWindowOS2::OS2OnDrawItem(
                 // For now we don't care about anything else
                 // just ignore the entire message!
                 //
                 // For now we don't care about anything else
                 // just ignore the entire message!
                 //
-                return TRUE;
+                return true;
             }
         }
         //
             }
         }
         //
@@ -3538,13 +3342,11 @@ bool wxWindowOS2::OS2OnDrawItem(
     vId = vId;
     pItemStruct = pItemStruct;
 #endif
     vId = vId;
     pItemStruct = pItemStruct;
 #endif
-    return FALSE;
+    return false;
 } // end of wxWindowOS2::OS2OnDrawItem
 
 } // end of wxWindowOS2::OS2OnDrawItem
 
-long wxWindowOS2::OS2OnMeasureItem(
-  int                               lId
-, WXMEASUREITEMSTRUCT*              pItemStruct
-)
+long wxWindowOS2::OS2OnMeasureItem( int lId,
+                                    WXMEASUREITEMSTRUCT* pItemStruct )
 {
 #if wxUSE_OWNER_DRAWN
     //
 {
 #if wxUSE_OWNER_DRAWN
     //
@@ -3604,17 +3406,15 @@ bool wxWindowOS2::HandleSysColorChange()
     wxSysColourChangedEvent         vEvent;
 
     vEvent.SetEventObject(this);
     wxSysColourChangedEvent         vEvent;
 
     vEvent.SetEventObject(this);
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleSysColorChange
 
 } // end of wxWindowOS2::HandleSysColorChange
 
-bool wxWindowOS2::HandleCtlColor(
-  WXHBRUSH*                         WXUNUSED(phBrush)
-)
+bool wxWindowOS2::HandleCtlColor( WXHBRUSH* WXUNUSED(phBrush) )
 {
     //
     // Not much provided with message. So not sure I can do anything with it
     //
 {
     //
     // Not much provided with message. So not sure I can do anything with it
     //
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::HandleCtlColor
 
 
 } // end of wxWindowOS2::HandleCtlColor
 
 
@@ -3639,7 +3439,7 @@ bool wxWindowOS2::HandlePaletteChanged()
     vEvent.SetEventObject(this);
     vEvent.SetChangedWindow(wxFindWinFromHandle(hWndPalChange));
 
     vEvent.SetEventObject(this);
     vEvent.SetChangedWindow(wxFindWinFromHandle(hWndPalChange));
 
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandlePaletteChanged
 
 //
 } // end of wxWindowOS2::HandlePaletteChanged
 
 //
@@ -3649,23 +3449,23 @@ void wxWindowOS2::OnSysColourChanged(
   wxSysColourChangedEvent&          rEvent
 )
 {
   wxSysColourChangedEvent&          rEvent
 )
 {
-    wxWindowListNode*               pNode = GetChildren().GetFirst();
+    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
 
 
-    while (pNode)
+    while (node)
     {
         //
         // Only propagate to non-top-level windows
         //
     {
         //
         // Only propagate to non-top-level windows
         //
-        wxWindow*                   pWin = (wxWindow *)pNode->GetData();
+        wxWindow*                   pWin = (wxWindow *)node->GetData();
 
         if (pWin->GetParent())
         {
             wxSysColourChangedEvent vEvent;
 
 
         if (pWin->GetParent())
         {
             wxSysColourChangedEvent vEvent;
 
-            rEvent.m_eventObject = pWin;
-            pWin->GetEventHandler()->ProcessEvent(vEvent);
+            rEvent.SetEventObject(pWin);
+            pWin->HandleWindowEvent(vEvent);
         }
         }
-        pNode = pNode->GetNext();
+        node = node->GetNext();
     }
 } // end of wxWindowOS2::OnSysColourChanged
 
     }
 } // end of wxWindowOS2::OnSysColourChanged
 
@@ -3677,7 +3477,7 @@ void wxWindow::OnPaint (
   wxPaintEvent&                     rEvent
 )
 {
   wxPaintEvent&                     rEvent
 )
 {
-    HDC                             hDC = (HDC)wxPaintDC::FindDCInCache((wxWindow*) rEvent.GetEventObject());
+    HDC                             hDC = (HDC)wxPaintDCImpl::FindDCInCache((wxWindow*) rEvent.GetEventObject());
 
     if (hDC != 0)
     {
 
     if (hDC != 0)
     {
@@ -3702,18 +3502,13 @@ bool wxWindowOS2::HandlePaint()
 
     if (::WinQueryUpdateRegion(GetHwnd(), hRgn) == RGN_ERROR)
     {
 
     if (::WinQueryUpdateRegion(GetHwnd(), hRgn) == RGN_ERROR)
     {
-         wxLogLastError("CreateRectRgn");
-         return FALSE;
+         wxLogLastError(wxT("CreateRectRgn"));
+         return false;
     }
     }
-
     // Get all the rectangles from the region, convert the individual
     // rectangles to "the other" coordinate system and reassemble a
     // region from the rectangles, to be feed into m_updateRegion.
     //
     // Get all the rectangles from the region, convert the individual
     // rectangles to "the other" coordinate system and reassemble a
     // region from the rectangles, to be feed into m_updateRegion.
     //
-    // FIXME: This is a bad hack since OS/2 API specifies that rectangles
-    //         passed into GpiSetRegion must not have Bottom > Top,
-    //          however, at first sight, it _seems_ to work nonetheless.
-    //
     RGNRECT                     vRgnData;
     PRECTL                      pUpdateRects = NULL;
     vRgnData.ulDirection = RECTDIR_LFRT_TOPBOT;
     RGNRECT                     vRgnData;
     PRECTL                      pUpdateRects = NULL;
     vRgnData.ulDirection = RECTDIR_LFRT_TOPBOT;
@@ -3743,18 +3538,17 @@ bool wxWindowOS2::HandlePaint()
             {
                 int                 rectHeight;
                 rectHeight = pUpdateRects[i].yTop - pUpdateRects[i].yBottom;
             {
                 int                 rectHeight;
                 rectHeight = pUpdateRects[i].yTop - pUpdateRects[i].yBottom;
-                pUpdateRects[i].yTop = height - pUpdateRects[i].yTop;
-                pUpdateRects[i].yBottom = pUpdateRects[i].yTop + rectHeight;
+                pUpdateRects[i].yBottom = height - pUpdateRects[i].yTop;
+                pUpdateRects[i].yTop = pUpdateRects[i].yBottom + rectHeight;
             }
             ::GpiSetRegion(hPS, hRgn, vRgnData.crc, pUpdateRects);
             delete [] pUpdateRects;
         }
     }
             }
             ::GpiSetRegion(hPS, hRgn, vRgnData.crc, pUpdateRects);
             delete [] pUpdateRects;
         }
     }
-
     m_updateRegion = wxRegion(hRgn, hPS);
 
     vEvent.SetEventObject(this);
     m_updateRegion = wxRegion(hRgn, hPS);
 
     vEvent.SetEventObject(this);
-    bProcessed = GetEventHandler()->ProcessEvent(vEvent);
+    bProcessed = HandleWindowEvent(vEvent);
 
     if (!bProcessed &&
          IsKindOf(CLASSINFO(wxPanel)) &&
 
     if (!bProcessed &&
          IsKindOf(CLASSINFO(wxPanel)) &&
@@ -3817,7 +3611,7 @@ bool wxWindowOS2::HandlePaint()
             }
         }
         ::WinEndPaint(hPS);
             }
         }
         ::WinEndPaint(hPS);
-        bProcessed = TRUE;
+        bProcessed = true;
     }
     else if (!bProcessed &&
              IsKindOf(CLASSINFO(wxPanel))
     }
     else if (!bProcessed &&
              IsKindOf(CLASSINFO(wxPanel))
@@ -3826,8 +3620,8 @@ bool wxWindowOS2::HandlePaint()
         //
         // Panel with children, usually fills a frame client so no borders.
         //
         //
         // Panel with children, usually fills a frame client so no borders.
         //
-        HPS                         hPS;
-        RECTL                       vRect;
+        HPS hPS;
+        RECTL vRect;
 
         hPS = ::WinBeginPaint( GetHwnd()
                               ,NULLHANDLE
 
         hPS = ::WinBeginPaint( GetHwnd()
                               ,NULLHANDLE
@@ -3854,47 +3648,42 @@ bool wxWindowOS2::HandlePaint()
                 ::WinFillRect(hPS, &vRect,  GetBackgroundColour().GetPixel());
         }
         ::WinEndPaint(hPS);
                 ::WinFillRect(hPS, &vRect,  GetBackgroundColour().GetPixel());
         }
         ::WinEndPaint(hPS);
-        bProcessed = TRUE;
+        bProcessed = true;
     }
     return bProcessed;
 } // end of wxWindowOS2::HandlePaint
 
     }
     return bProcessed;
 } // end of wxWindowOS2::HandlePaint
 
-bool wxWindowOS2::HandleEraseBkgnd(
-  WXHDC                             hDC
-)
+bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC )
 {
 {
-    SWP                             vSwp;
-    bool                            rc;
+    SWP vSwp;
+    bool rc;
 
     ::WinQueryWindowPos(GetHwnd(), &vSwp);
     if (vSwp.fl & SWP_MINIMIZE)
 
     ::WinQueryWindowPos(GetHwnd(), &vSwp);
     if (vSwp.fl & SWP_MINIMIZE)
-        return TRUE;
+        return true;
 
 
-    wxDC                            vDC;
+    wxClientDC vDC(this);
+    wxPMDCImpl *impl = (wxPMDCImpl*) vDC.GetImpl();
+    impl->SetHDC(hDC);
+    impl->SetHPS((HPS)hDC); // this is really a PS
 
 
-    vDC.m_hPS = (HPS)hDC; // this is really a PS
-    vDC.SetWindow((wxWindow*)this);
-    vDC.BeginDrawing();
-
-    wxEraseEvent                    vEvent(m_windowId, &vDC);
+    wxEraseEvent vEvent(m_windowId, &vDC);
 
     vEvent.SetEventObject(this);
 
 
     vEvent.SetEventObject(this);
 
-    rc = GetEventHandler()->ProcessEvent(vEvent);
+    rc = HandleWindowEvent(vEvent);
 
 
-    vDC.EndDrawing();
-    vDC.m_hPS = NULLHANDLE;
-    return TRUE;
+    impl->SetHPS(NULLHANDLE);
+    return true;
 } // end of wxWindowOS2::HandleEraseBkgnd
 
 } // end of wxWindowOS2::HandleEraseBkgnd
 
-void wxWindowOS2::OnEraseBackground(
-  wxEraseEvent&                     rEvent
-)
+void wxWindowOS2::OnEraseBackground(wxEraseEvent& rEvent)
 {
 {
-    RECTL                           vRect;
-    HPS                             hPS = rEvent.m_dc->m_hPS;
-    APIRET                          rc;
-    LONG                            lColor = m_backgroundColour.GetPixel();
+    RECTL   vRect;
+    wxPMDCImpl *impl = (wxPMDCImpl*) rEvent.GetDC()->GetImpl();
+    HPS     hPS = impl->GetHPS();
+    APIRET  rc;
+    LONG    lColor = m_backgroundColour.GetPixel();
 
     rc = ::WinQueryWindowRect(GetHwnd(), &vRect);
     rc = ::WinFillRect(hPS, &vRect, lColor);
 
     rc = ::WinQueryWindowRect(GetHwnd(), &vRect);
     rc = ::WinFillRect(hPS, &vRect, lColor);
@@ -3909,7 +3698,7 @@ bool wxWindowOS2::HandleMinimize()
     wxIconizeEvent                  vEvent(m_windowId);
 
     vEvent.SetEventObject(this);
     wxIconizeEvent                  vEvent(m_windowId);
 
     vEvent.SetEventObject(this);
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleMinimize
 
 bool wxWindowOS2::HandleMaximize()
 } // end of wxWindowOS2::HandleMinimize
 
 bool wxWindowOS2::HandleMaximize()
@@ -3917,35 +3706,30 @@ bool wxWindowOS2::HandleMaximize()
     wxMaximizeEvent                 vEvent(m_windowId);
 
     vEvent.SetEventObject(this);
     wxMaximizeEvent                 vEvent(m_windowId);
 
     vEvent.SetEventObject(this);
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleMaximize
 
 } // end of wxWindowOS2::HandleMaximize
 
-bool wxWindowOS2::HandleMove(
-  int                               nX
-, int                               nY
-)
+bool wxWindowOS2::HandleMove( int nX, int nY )
 {
 {
-    wxMoveEvent                     vEvent(wxPoint(nX, nY), m_windowId);
+    wxPoint pt(nX, nY);
+    wxMoveEvent vEvent(pt, m_windowId);
 
     vEvent.SetEventObject(this);
 
     vEvent.SetEventObject(this);
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 }  // end of wxWindowOS2::HandleMove
 
 }  // end of wxWindowOS2::HandleMove
 
-bool wxWindowOS2::HandleSize(
-  int                               nWidth
-, int                               nHeight
-, WXUINT                            WXUNUSED(nFlag)
-)
+bool wxWindowOS2::HandleSize( int    nWidth,
+                              int    nHeight,
+                              WXUINT WXUNUSED(nFlag) )
 {
 {
-    wxSizeEvent                     vEvent(wxSize(nWidth, nHeight), m_windowId);
+    wxSize sz(nWidth, nHeight);
+    wxSizeEvent vEvent(sz, m_windowId);
 
     vEvent.SetEventObject(this);
 
     vEvent.SetEventObject(this);
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::HandleSize
 
 } // end of wxWindowOS2::HandleSize
 
-bool wxWindowOS2::HandleGetMinMaxInfo(
-  PSWP                              pSwp
-)
+bool wxWindowOS2::HandleGetMinMaxInfo( PSWP pSwp )
 {
     POINTL                          vPoint;
 
 {
     POINTL                          vPoint;
 
@@ -3964,19 +3748,17 @@ bool wxWindowOS2::HandleGetMinMaxInfo(
             break;
 
         default:
             break;
 
         default:
-            return FALSE;
+            return false;
     }
     }
-    return TRUE;
+    return true;
 } // end of wxWindowOS2::HandleGetMinMaxInfo
 
 // ---------------------------------------------------------------------------
 // command messages
 // ---------------------------------------------------------------------------
 } // end of wxWindowOS2::HandleGetMinMaxInfo
 
 // ---------------------------------------------------------------------------
 // command messages
 // ---------------------------------------------------------------------------
-bool wxWindowOS2::HandleCommand(
-  WXWORD                            wId
-, WXWORD                            wCmd
-, WXHWND                            hControl
-)
+bool wxWindowOS2::HandleCommand( WXWORD wId,
+                                 WXWORD wCmd,
+                                 WXHWND hControl )
 {
 #if wxUSE_MENUS_NATIVE
     if (wxCurrentPopupMenu)
 {
 #if wxUSE_MENUS_NATIVE
     if (wxCurrentPopupMenu)
@@ -3998,13 +3780,11 @@ bool wxWindowOS2::HandleCommand(
     if (pWin)
         return pWin->OS2Command(wCmd, wId);
 
     if (pWin)
         return pWin->OS2Command(wCmd, wId);
 
-    return FALSE;
+    return false;
 } // end of wxWindowOS2::HandleCommand
 
 } // end of wxWindowOS2::HandleCommand
 
-bool wxWindowOS2::HandleSysCommand(
-  WXWPARAM                          wParam
-, WXLPARAM                          WXUNUSED(lParam)
-)
+bool wxWindowOS2::HandleSysCommand( WXWPARAM wParam,
+                                    WXLPARAM WXUNUSED(lParam) )
 {
     //
     // 4 bits are reserved
 {
     //
     // 4 bits are reserved
@@ -4017,13 +3797,13 @@ bool wxWindowOS2::HandleSysCommand(
         case SC_MINIMIZE:
             return HandleMinimize();
     }
         case SC_MINIMIZE:
             return HandleMinimize();
     }
-    return FALSE;
+    return false;
 } // end of wxWindowOS2::HandleSysCommand
 
 // ---------------------------------------------------------------------------
 // mouse events
 // ---------------------------------------------------------------------------
 } // end of wxWindowOS2::HandleSysCommand
 
 // ---------------------------------------------------------------------------
 // mouse events
 // ---------------------------------------------------------------------------
-//TODO!!! check against MSW
+//TODO: check against MSW
 void wxWindowOS2::InitMouseEvent(
   wxMouseEvent&                     rEvent
 , int                               nX
 void wxWindowOS2::InitMouseEvent(
   wxMouseEvent&                     rEvent
 , int                               nX
@@ -4039,14 +3819,11 @@ void wxWindowOS2::InitMouseEvent(
     rEvent.m_shiftDown   = ((uFlags & KC_SHIFT) != 0);
     rEvent.m_controlDown = ((uFlags & KC_CTRL) != 0);
     rEvent.m_altDown     = ((uFlags & KC_ALT) != 0);
     rEvent.m_shiftDown   = ((uFlags & KC_SHIFT) != 0);
     rEvent.m_controlDown = ((uFlags & KC_CTRL) != 0);
     rEvent.m_altDown     = ((uFlags & KC_ALT) != 0);
-    rEvent.m_leftDown    = (::WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) &
-                           0x8000) != 0;
-    rEvent.m_middleDown  = (::WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) &
-                           0x8000) != 0;
-    rEvent.m_rightDown   = (::WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) &
-                           0x8000) != 0;
+    rEvent.m_leftDown    = IsKeyDown(VK_BUTTON1);
+    rEvent.m_middleDown  = IsKeyDown(VK_BUTTON3);
+    rEvent.m_rightDown   = IsKeyDown(VK_BUTTON2);
     rEvent.SetTimestamp(s_currentMsg.time);
     rEvent.SetTimestamp(s_currentMsg.time);
-    rEvent.m_eventObject = this;
+    rEvent.SetEventObject(this);
     rEvent.SetId(GetId());
 
 #if wxUSE_MOUSEEVENT_HACK
     rEvent.SetId(GetId());
 
 #if wxUSE_MOUSEEVENT_HACK
@@ -4056,14 +3833,12 @@ void wxWindowOS2::InitMouseEvent(
 #endif // wxUSE_MOUSEEVENT_HACK
 } // end of wxWindowOS2::InitMouseEvent
 
 #endif // wxUSE_MOUSEEVENT_HACK
 } // end of wxWindowOS2::InitMouseEvent
 
-bool wxWindowOS2::HandleMouseEvent(
-  WXUINT                            uMsg
-, int                               nX
-, int                               nY
-, WXUINT                            uFlags
-)
+bool wxWindowOS2::HandleMouseEvent( WXUINT uMsg,
+                                    int    nX,
+                                    int    nY,
+                                    WXUINT uFlags )
 {
 {
-    bool                            bProcessed = FALSE;
+    bool bProcessed = false;
 
     //
     // The mouse events take consecutive IDs from WM_MOUSEFIRST to
 
     //
     // The mouse events take consecutive IDs from WM_MOUSEFIRST to
@@ -4088,7 +3863,7 @@ bool wxWindowOS2::HandleMouseEvent(
     // Bounds check
     if ((uMsg >= WM_MOUSEMOVE) && (uMsg <= WM_BUTTON3DBLCLK))
     {
     // Bounds check
     if ((uMsg >= WM_MOUSEMOVE) && (uMsg <= WM_BUTTON3DBLCLK))
     {
-        wxMouseEvent               vEvent(eventsMouse[uMsg - WM_MOUSEMOVE]);
+        wxMouseEvent vEvent(eventsMouse[uMsg - WM_MOUSEMOVE]);
 
         InitMouseEvent( vEvent
                        ,nX
 
         InitMouseEvent( vEvent
                        ,nX
@@ -4096,35 +3871,33 @@ bool wxWindowOS2::HandleMouseEvent(
                        ,uFlags
                        );
 
                        ,uFlags
                        );
 
-        bProcessed = GetEventHandler()->ProcessEvent(vEvent);
+        bProcessed = HandleWindowEvent(vEvent);
         if (!bProcessed)
         {
         if (!bProcessed)
         {
-            HPOINTER               hCursor = (HPOINTER)GetCursor().GetHCURSOR();
+            HPOINTER hCursor = (HPOINTER)GetCursor().GetHCURSOR();
 
             if (hCursor != NULLHANDLE)
             {
                 ::WinSetPointer(HWND_DESKTOP, hCursor);
 
             if (hCursor != NULLHANDLE)
             {
                 ::WinSetPointer(HWND_DESKTOP, hCursor);
-                bProcessed = TRUE;
+                bProcessed = true;
             }
         }
     }
     return bProcessed;
 } // end of wxWindowOS2::HandleMouseEvent
 
             }
         }
     }
     return bProcessed;
 } // end of wxWindowOS2::HandleMouseEvent
 
-bool wxWindowOS2::HandleMouseMove(
-  int                               nX
-, int                               nY
-, WXUINT                            uFlags
-)
+bool wxWindowOS2::HandleMouseMove( int nX,
+                                   int nY,
+                                   WXUINT uFlags )
 {
     if (!m_bMouseInWindow)
     {
         //
         // Generate an ENTER event
         //
 {
     if (!m_bMouseInWindow)
     {
         //
         // Generate an ENTER event
         //
-        m_bMouseInWindow = TRUE;
+        m_bMouseInWindow = true;
 
 
-        wxMouseEvent                vEvent(wxEVT_ENTER_WINDOW);
+        wxMouseEvent vEvent(wxEVT_ENTER_WINDOW);
 
         InitMouseEvent( vEvent
                        ,nX
 
         InitMouseEvent( vEvent
                        ,nX
@@ -4132,7 +3905,7 @@ bool wxWindowOS2::HandleMouseMove(
                        ,uFlags
                       );
 
                        ,uFlags
                       );
 
-        (void)GetEventHandler()->ProcessEvent(vEvent);
+        (void)HandleWindowEvent(vEvent);
     }
     return HandleMouseEvent( WM_MOUSEMOVE
                             ,nX
     }
     return HandleMouseEvent( WM_MOUSEMOVE
                             ,nX
@@ -4163,7 +3936,7 @@ wxKeyEvent wxWindowOS2::CreateKeyEvent(
     vEvent.m_controlDown = IsCtrlDown();
     vEvent.m_altDown     = (HIWORD(lParam) & KC_ALT) == KC_ALT;
 
     vEvent.m_controlDown = IsCtrlDown();
     vEvent.m_altDown     = (HIWORD(lParam) & KC_ALT) == KC_ALT;
 
-    vEvent.m_eventObject = (wxWindow *)this; // const_cast
+    vEvent.SetEventObject((wxWindow *)this); // const_cast
     vEvent.m_keyCode     = nId;
     vEvent.m_rawCode = (wxUint32)wParam;
     vEvent.m_rawFlags = (wxUint32)lParam;
     vEvent.m_keyCode     = nId;
     vEvent.m_rawCode = (wxUint32)wParam;
     vEvent.m_rawFlags = (wxUint32)lParam;
@@ -4190,17 +3963,15 @@ wxKeyEvent wxWindowOS2::CreateKeyEvent(
 } // end of wxWindowOS2::CreateKeyEvent
 
 //
 } // end of wxWindowOS2::CreateKeyEvent
 
 //
-// isASCII is TRUE only when we're called from WM_CHAR handler and not from
+// isASCII is true only when we're called from WM_CHAR handler and not from
 // WM_KEYDOWN one
 //
 // WM_KEYDOWN one
 //
-bool wxWindowOS2::HandleChar(
-  WXWPARAM                          wParam
-, WXLPARAM                          lParam
-, bool                              isASCII
-)
+bool wxWindowOS2::HandleChar( WXWPARAM WXUNUSED(wParam),
+                              WXLPARAM lParam,
+                              bool     isASCII )
 {
 {
-    bool                            bCtrlDown = FALSE;
-    int                             vId;
+    bool bCtrlDown = false;
+    int  vId;
 
     if (m_bLastKeydownProcessed)
     {
 
     if (m_bLastKeydownProcessed)
     {
@@ -4209,15 +3980,15 @@ bool wxWindowOS2::HandleChar(
         // EVT_KEY_DOWN handler is meant, by design, to prevent EVT_CHARs
         // from happening, so just bail out at this point.
         //
         // EVT_KEY_DOWN handler is meant, by design, to prevent EVT_CHARs
         // from happening, so just bail out at this point.
         //
-        m_bLastKeydownProcessed = FALSE;
-        return TRUE;
+        m_bLastKeydownProcessed = false;
+        return true;
     }
     if (isASCII)
     {
         //
         // If 1 -> 26, translate to either special keycode or just set
         // ctrlDown.  IOW, Ctrl-C should result in keycode == 3 and
     }
     if (isASCII)
     {
         //
         // If 1 -> 26, translate to either special keycode or just set
         // ctrlDown.  IOW, Ctrl-C should result in keycode == 3 and
-        // ControlDown() == TRUE.
+        // ControlDown() == true.
         //
         vId = SHORT1FROMMP(lParam);
         if ((vId > 0) && (vId < 27))
         //
         vId = SHORT1FROMMP(lParam);
         if ((vId > 0) && (vId < 27))
@@ -4237,7 +4008,7 @@ bool wxWindowOS2::HandleChar(
                     break;
 
                 default:
                     break;
 
                 default:
-                    bCtrlDown = TRUE;
+                    bCtrlDown = true;
                     break;
             }
         }
                     break;
             }
         }
@@ -4246,27 +4017,23 @@ bool wxWindowOS2::HandleChar(
     {
         vId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
         if (vId == 0)
     {
         vId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
         if (vId == 0)
-            return FALSE;
+            return false;
     }
 
     }
 
-    wxKeyEvent                      vEvent(CreateKeyEvent( wxEVT_CHAR
-                                                          ,vId
-                                                          ,lParam
-                                                         ));
+    wxKeyEvent vEvent(CreateKeyEvent( wxEVT_CHAR, vId, lParam ));
 
     if (bCtrlDown)
     {
 
     if (bCtrlDown)
     {
-        vEvent.m_controlDown = TRUE;
+        vEvent.m_controlDown = true;
     }
     }
-    return (GetEventHandler()->ProcessEvent(vEvent));
+
+    return (HandleWindowEvent(vEvent));
 }
 
 }
 
-bool wxWindowOS2::HandleKeyDown(
-  WXWPARAM                          wParam
-, WXLPARAM                          lParam
-)
+bool wxWindowOS2::HandleKeyDown( WXWPARAM wParam,
+                                 WXLPARAM lParam )
 {
 {
-    int                             nId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
+    int nId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
 
     if (!nId)
     {
 
     if (!nId)
     {
@@ -4278,47 +4045,45 @@ bool wxWindowOS2::HandleKeyDown(
 
     if (nId != -1)
     {
 
     if (nId != -1)
     {
-        wxKeyEvent                  vEvent(CreateKeyEvent( wxEVT_KEY_DOWN
-                                                          ,nId
-                                                          ,(MPARAM)lParam
-                                                          ,(MPARAM)wParam
-                                                         ));
+        wxKeyEvent  vEvent(CreateKeyEvent( wxEVT_KEY_DOWN
+                                          ,nId
+                                          ,(MPARAM)lParam
+                                          ,(MPARAM)wParam
+                                         ));
 
 
-        if (GetEventHandler()->ProcessEvent(vEvent))
+        if (HandleWindowEvent(vEvent))
         {
         {
-            return TRUE;
+            return true;
         }
     }
         }
     }
-    return FALSE;
+    return false;
 } // end of wxWindowOS2::HandleKeyDown
 
 } // end of wxWindowOS2::HandleKeyDown
 
-bool wxWindowOS2::HandleKeyUp(
-  WXWPARAM                          wParam
-, WXLPARAM                          lParam
-)
+bool wxWindowOS2::HandleKeyUp( WXWPARAM wParam,
+                               WXLPARAM lParam )
 {
 {
-    int                             nId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
+    int nId = wxCharCodeOS2ToWX((int)SHORT2FROMMP(lParam));
 
     if (!nId)
     {
         //
         // Normal ASCII char
         //
 
     if (!nId)
     {
         //
         // Normal ASCII char
         //
-        nId = (int)wParam;
+        nId = CHAR1FROMMP(lParam);
     }
 
     if (nId != -1)
     {
     }
 
     if (nId != -1)
     {
-        wxKeyEvent                  vEvent(CreateKeyEvent( wxEVT_KEY_UP
-                                                          ,nId
-                                                          ,lParam
-                                                          ,wParam
-                                                         ));
-
-        if (GetEventHandler()->ProcessEvent(vEvent))
-            return TRUE;
+        wxKeyEvent vEvent(CreateKeyEvent( wxEVT_KEY_UP
+                                         ,nId
+                                         ,(MPARAM)lParam
+                                         ,(MPARAM)wParam
+                                        ));
+
+        if (HandleWindowEvent(vEvent))
+            return true;
     }
     }
-    return FALSE;
+    return false;
 } // end of wxWindowOS2::HandleKeyUp
 
 // ---------------------------------------------------------------------------
 } // end of wxWindowOS2::HandleKeyUp
 
 // ---------------------------------------------------------------------------
@@ -4329,12 +4094,10 @@ bool wxWindowOS2::HandleKeyUp(
 // scrolling
 // ---------------------------------------------------------------------------
 
 // scrolling
 // ---------------------------------------------------------------------------
 
-bool wxWindowOS2::OS2OnScroll(
-  int                               nOrientation
-, WXWORD                            wParam
-, WXWORD                            wPos
-, WXHWND                            hControl
-)
+bool wxWindowOS2::OS2OnScroll( int nOrientation,
+                               WXWORD wParam,
+                               WXWORD wPos,
+                               WXHWND hControl )
 {
     if (hControl)
     {
 {
     if (hControl)
     {
@@ -4352,118 +4115,43 @@ bool wxWindowOS2::OS2OnScroll(
 
     vEvent.SetPosition(wPos);
     vEvent.SetOrientation(nOrientation);
 
     vEvent.SetPosition(wPos);
     vEvent.SetOrientation(nOrientation);
-    vEvent.m_eventObject = this;
+    vEvent.SetEventObject(this);
 
     switch (wParam)
     {
         case SB_LINEUP:
 
     switch (wParam)
     {
         case SB_LINEUP:
-            vEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP;
+            vEvent.SetEventType(wxEVT_SCROLLWIN_LINEUP);
             break;
 
         case SB_LINEDOWN:
             break;
 
         case SB_LINEDOWN:
-            vEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN;
+            vEvent.SetEventType(wxEVT_SCROLLWIN_LINEDOWN);
             break;
 
         case SB_PAGEUP:
             break;
 
         case SB_PAGEUP:
-            vEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP;
+            vEvent.SetEventType(wxEVT_SCROLLWIN_PAGEUP);
             break;
 
         case SB_PAGEDOWN:
             break;
 
         case SB_PAGEDOWN:
-            vEvent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN;
+            vEvent.SetEventType(wxEVT_SCROLLWIN_PAGEDOWN);
             break;
 
         case SB_SLIDERPOSITION:
             break;
 
         case SB_SLIDERPOSITION:
-            vEvent.m_eventType = wxEVT_SCROLLWIN_THUMBRELEASE;
+            vEvent.SetEventType(wxEVT_SCROLLWIN_THUMBRELEASE);
             break;
 
         case SB_SLIDERTRACK:
             break;
 
         case SB_SLIDERTRACK:
-            vEvent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK;
+            vEvent.SetEventType(wxEVT_SCROLLWIN_THUMBTRACK);
             break;
 
         default:
             break;
 
         default:
-            return FALSE;
+            return false;
     }
     }
-    return GetEventHandler()->ProcessEvent(vEvent);
+    return HandleWindowEvent(vEvent);
 } // end of wxWindowOS2::OS2OnScroll
 
 } // end of wxWindowOS2::OS2OnScroll
 
-void wxWindowOS2::MoveChildren(
-  int                               nDiff
-)
-{
-    //
-    // We want to handle top levels ourself, manually
-    //
-    if (!IsTopLevel() && GetAutoLayout())
-    {
-        Layout();
-    }
-    else
-    {
-        SWP                         vSwp;
-
-        for (wxWindowList::Node* pNode = GetChildren().GetFirst();
-             pNode;
-             pNode = pNode->GetNext())
-        {
-            wxWindow*               pWin = pNode->GetData();
-
-            ::WinQueryWindowPos( GetHwndOf(pWin)
-                                ,&vSwp
-                               );
-            if (pWin->IsKindOf(CLASSINFO(wxControl)))
-            {
-                wxControl*          pCtrl;
-
-                //
-                // Must deal with controls that have margins like ENTRYFIELD.  The SWP
-                // struct of such a control will have and origin offset from its intended
-                // position by the width of the margins.
-                //
-                pCtrl = wxDynamicCast(pWin, wxControl);
-                vSwp.y -= pCtrl->GetYComp();
-                vSwp.x -= pCtrl->GetXComp();
-            }
-            ::WinSetWindowPos( GetHwndOf(pWin)
-                              ,HWND_TOP
-                              ,vSwp.x
-                              ,vSwp.y - nDiff
-                              ,vSwp.cx
-                              ,vSwp.cy
-                              ,SWP_MOVE
-                             );
-            ::WinQueryWindowPos(GetHwndOf(pWin), pWin->GetSwp());
-            if (pWin->IsKindOf(CLASSINFO(wxRadioBox)))
-            {
-                wxRadioBox*     pRadioBox;
-
-                pRadioBox = wxDynamicCast(pWin, wxRadioBox);
-                pRadioBox->AdjustButtons( (int)vSwp.x
-                                         ,(int)vSwp.y - nDiff
-                                         ,(int)vSwp.cx
-                                         ,(int)vSwp.cy
-                                         ,pRadioBox->GetSizeFlags()
-                                        );
-            }
-            if (pWin->IsKindOf(CLASSINFO(wxSlider)))
-            {
-                wxSlider*           pSlider;
-
-                pSlider = wxDynamicCast(pWin, wxSlider);
-                pSlider->AdjustSubControls( (int)vSwp.x
-                                           ,(int)vSwp.y - nDiff
-                                           ,(int)vSwp.cx
-                                           ,(int)vSwp.cy
-                                           ,(int)pSlider->GetSizeFlags()
-                                          );
-            }
-        }
-    }
-    Refresh();
-} // end of wxWindowOS2::MoveChildren
-
 //
 //  Getting the Y position for a window, like a control, is a real
 //
 //  Getting the Y position for a window, like a control, is a real
-//  pain.  There are three sitatuions we must deal with in determining
+//  pain.  There are three situations we must deal with in determining
 //  the OS2 to wxWidgets Y coordinate.
 //
 //  1)  The controls are created in a dialog.
 //  the OS2 to wxWidgets Y coordinate.
 //
 //  1)  The controls are created in a dialog.
@@ -4492,15 +4180,15 @@ void wxWindowOS2::MoveChildren(
 //      as that will be the eventual size of the panel after the frame resizes
 //      it!
 //
 //      as that will be the eventual size of the panel after the frame resizes
 //      it!
 //
-int wxWindowOS2::GetOS2ParentHeight(
-  wxWindowOS2*               pParent
-)
+int wxWindowOS2::GetOS2ParentHeight( wxWindowOS2* pParent )
 {
 {
+    if (pParent)
+    {
     //
     // Case 1
     //
     //
     // Case 1
     //
-    if (pParent->IsKindOf(CLASSINFO(wxDialog)))
-        return(pParent->GetClientSize().y);
+        if (pParent->IsKindOf(CLASSINFO(wxDialog)))
+            return(pParent->GetClientSize().y);
 
     //
     // Case 2 -- if we are one of the separately built standard Frame
 
     //
     // Case 2 -- if we are one of the separately built standard Frame
@@ -4508,39 +4196,43 @@ int wxWindowOS2::GetOS2ParentHeight(
     //           use the frame, itself, for positioning.  Otherwise we are
     //           child window and want to use the Frame's client.
     //
     //           use the frame, itself, for positioning.  Otherwise we are
     //           child window and want to use the Frame's client.
     //
-    else if (pParent->IsKindOf(CLASSINFO(wxFrame)))
-    {
-        if (IsKindOf(CLASSINFO(wxStatusBar)) ||
-            IsKindOf(CLASSINFO(wxMenuBar))   ||
-            IsKindOf(CLASSINFO(wxToolBar))
-           )
+        else if (pParent->IsKindOf(CLASSINFO(wxFrame)))
         {
         {
-            if (IsKindOf(CLASSINFO(wxToolBar)))
+            if (IsKindOf(CLASSINFO(wxStatusBar)) ||
+                IsKindOf(CLASSINFO(wxMenuBar))   ||
+                IsKindOf(CLASSINFO(wxToolBar))
+               )
             {
             {
-                wxFrame*            pFrame = wxDynamicCast(GetParent(), wxFrame);
+                if (IsKindOf(CLASSINFO(wxToolBar)))
+                {
+                    wxFrame*        pFrame = wxDynamicCast(GetParent(), wxFrame);
 
 
-                if (pFrame->GetToolBar() == this)
-                    return(pParent->GetSize().y);
+                    if (pFrame->GetToolBar() == this)
+                        return(pParent->GetSize().y);
+                    else
+                        return(pParent->GetClientSize().y);
+                }
                 else
                 else
-                    return(pParent->GetClientSize().y);
+                    return(pParent->GetSize().y);
             }
             else
             }
             else
-                return(pParent->GetSize().y);
+                return(pParent->GetClientSize().y);
         }
         }
+        //
+        // Case -- this is for any window that is the sole child of a Frame.
+        //         The grandparent must exist and it must be of type CFrame
+        //         and it's height must be different. Otherwise the standard
+        //         applies.
+        //
         else
             return(pParent->GetClientSize().y);
     }
         else
             return(pParent->GetClientSize().y);
     }
-    //
-    // Case -- this is for any window that is the sole child of a Frame.
-    //         The grandparent must exist and it must be of type CFrame
-    //         and it's height must be different. Otherwise the standard
-    //         applies.
-    //
-    else
+    else // We must be a child of the screen
     {
     {
-        return(pParent->GetClientSize().y);
+        int nHeight;
+        wxDisplaySize(NULL,&nHeight);
+        return(nHeight);
     }
     }
-    return(0L);
 } // end of wxWindowOS2::GetOS2ParentHeight
 
 //
 } // end of wxWindowOS2::GetOS2ParentHeight
 
 //
@@ -4614,6 +4306,8 @@ int wxCharCodeOS2ToWX(
         case VK_CTRL:       nId = WXK_CONTROL; break;
         case VK_PAUSE:      nId = WXK_PAUSE; break;
         case VK_SPACE:      nId = WXK_SPACE; break;
         case VK_CTRL:       nId = WXK_CONTROL; break;
         case VK_PAUSE:      nId = WXK_PAUSE; break;
         case VK_SPACE:      nId = WXK_SPACE; break;
+        case VK_PAGEUP:     nId = WXK_PAGEUP; break;
+        case VK_PAGEDOWN:   nId = WXK_PAGEDOWN; break;
         case VK_ESC:        nId = WXK_ESCAPE; break;
         case VK_END:        nId = WXK_END; break;
         case VK_HOME :      nId = WXK_HOME; break;
         case VK_ESC:        nId = WXK_ESCAPE; break;
         case VK_END:        nId = WXK_END; break;
         case VK_HOME :      nId = WXK_HOME; break;
@@ -4670,20 +4364,21 @@ int wxCharCodeOS2ToWX(
     return nId;
 } // end of wxCharCodeOS2ToWX
 
     return nId;
 } // end of wxCharCodeOS2ToWX
 
-int wxCharCodeWXToOS2(
-  int                               nId
-, bool*                             bIsVirtual
-)
+int wxCharCodeWXToOS2( int nId,
+                       bool* bIsVirtual)
 {
 {
-    int                             nKeySym = 0;
+    int nKeySym = 0;
 
 
-    *bIsVirtual = TRUE;
+    if ( bIsVirtual )
+        *bIsVirtual = true;
     switch (nId)
     {
         case WXK_CLEAR:     nKeySym = VK_CLEAR; break;
         case WXK_SHIFT:     nKeySym = VK_SHIFT; break;
         case WXK_CONTROL:   nKeySym = VK_CTRL; break;
         case WXK_PAUSE:     nKeySym = VK_PAUSE; break;
     switch (nId)
     {
         case WXK_CLEAR:     nKeySym = VK_CLEAR; break;
         case WXK_SHIFT:     nKeySym = VK_SHIFT; break;
         case WXK_CONTROL:   nKeySym = VK_CTRL; break;
         case WXK_PAUSE:     nKeySym = VK_PAUSE; break;
+        case WXK_PAGEUP:    nKeySym = VK_PAGEUP; break;
+        case WXK_PAGEDOWN:  nKeySym = VK_PAGEDOWN; break;
         case WXK_END:       nKeySym = VK_END; break;
         case WXK_HOME :     nKeySym = VK_HOME; break;
         case WXK_LEFT :     nKeySym = VK_LEFT; break;
         case WXK_END:       nKeySym = VK_END; break;
         case WXK_HOME :     nKeySym = VK_HOME; break;
         case WXK_LEFT :     nKeySym = VK_LEFT; break;
@@ -4721,7 +4416,8 @@ int wxCharCodeWXToOS2(
         case WXK_SCROLL:    nKeySym = VK_SCRLLOCK; break;
         default:
         {
         case WXK_SCROLL:    nKeySym = VK_SCRLLOCK; break;
         default:
         {
-            *bIsVirtual = FALSE;
+            if ( bIsVirtual )
+                *bIsVirtual = false;
             nKeySym = nId;
             break;
         }
             nKeySym = nId;
             break;
         }
@@ -4729,6 +4425,29 @@ int wxCharCodeWXToOS2(
     return nKeySym;
 } // end of wxCharCodeWXToOS2
 
     return nKeySym;
 } // end of wxCharCodeWXToOS2
 
+
+bool wxGetKeyState(wxKeyCode key)
+{
+    wxASSERT_MSG(key != WXK_LBUTTON && key != WXK_RBUTTON && key !=
+        WXK_MBUTTON, wxT("can't use wxGetKeyState() for mouse buttons"));
+
+    const LONG vk = wxCharCodeWXToOS2(key);
+    // if the requested key is a LED key, return true if the led is pressed
+    if ( key == WXK_NUMLOCK || key == WXK_CAPITAL || key == WXK_SCROLL )
+    {
+        // low order bit means LED is highlighted and high order one means the
+        // key is down; for compatibility with the other ports return true if
+        // either one is set
+        return ::WinGetKeyState(HWND_DESKTOP, vk) != 0;
+
+    }
+    else // normal key
+    {
+        return IsKeyDown(vk);
+    }
+}
+
+
 wxWindow* wxGetActiveWindow()
 {
     HWND                            hWnd = ::WinQueryActiveWindow(HWND_DESKTOP);
 wxWindow* wxGetActiveWindow()
 {
     HWND                            hWnd = ::WinQueryActiveWindow(HWND_DESKTOP);
@@ -4741,467 +4460,465 @@ wxWindow* wxGetActiveWindow()
 } // end of wxGetActiveWindow
 
 #ifdef __WXDEBUG__
 } // end of wxGetActiveWindow
 
 #ifdef __WXDEBUG__
-const char* wxGetMessageName(
-  int                               nMessage)
+const wxChar* wxGetMessageName( int nMessage )
 {
     switch (nMessage)
     {
 {
     switch (nMessage)
     {
-        case 0x0000: return "WM_NULL";
-        case 0x0001: return "WM_CREATE";
-        case 0x0002: return "WM_DESTROY";
-        case 0x0004: return "WM_ENABLE";
-        case 0x0005: return "WM_SHOW";
-        case 0x0006: return "WM_MOVE";
-        case 0x0007: return "WM_SIZE";
-        case 0x0008: return "WM_ADJUSTWINDOWPOS";
-        case 0x0009: return "WM_CALCVALIDRECTS";
-        case 0x000A: return "WM_SETWINDOWPARAMS";
-        case 0x000B: return "WM_QUERYWINDOWPARAMS";
-        case 0x000C: return "WM_HITTEST";
-        case 0x000D: return "WM_ACTIVATE";
-        case 0x000F: return "WM_SETFOCUS";
-        case 0x0010: return "WM_SETSELECTION";
-        case 0x0011: return "WM_PPAINT";
-        case 0x0012: return "WM_PSETFOCUS";
-        case 0x0013: return "WM_PSYSCOLORCHANGE";
-        case 0x0014: return "WM_PSIZE";
-        case 0x0015: return "WM_PACTIVATE";
-        case 0x0016: return "WM_PCONTROL";
-        case 0x0020: return "WM_COMMAND";
-        case 0x0021: return "WM_SYSCOMMAND";
-        case 0x0022: return "WM_HELP";
-        case 0x0023: return "WM_PAINT";
-        case 0x0024: return "WM_TIMER";
-        case 0x0025: return "WM_SEM1";
-        case 0x0026: return "WM_SEM2";
-        case 0x0027: return "WM_SEM3";
-        case 0x0028: return "WM_SEM4";
-        case 0x0029: return "WM_CLOSE";
-        case 0x002A: return "WM_QUIT";
-        case 0x002B: return "WM_SYSCOLORCHANGE";
-        case 0x002D: return "WM_SYSVALUECHANGE";
-        case 0x002E: return "WM_APPTERMINATENOTIFY";
-        case 0x002F: return "WM_PRESPARAMCHANGED";
+        case 0x0000: return wxT("WM_NULL");
+        case 0x0001: return wxT("WM_CREATE");
+        case 0x0002: return wxT("WM_DESTROY");
+        case 0x0004: return wxT("WM_ENABLE");
+        case 0x0005: return wxT("WM_SHOW");
+        case 0x0006: return wxT("WM_MOVE");
+        case 0x0007: return wxT("WM_SIZE");
+        case 0x0008: return wxT("WM_ADJUSTWINDOWPOS");
+        case 0x0009: return wxT("WM_CALCVALIDRECTS");
+        case 0x000A: return wxT("WM_SETWINDOWPARAMS");
+        case 0x000B: return wxT("WM_QUERYWINDOWPARAMS");
+        case 0x000C: return wxT("WM_HITTEST");
+        case 0x000D: return wxT("WM_ACTIVATE");
+        case 0x000F: return wxT("WM_SETFOCUS");
+        case 0x0010: return wxT("WM_SETSELECTION");
+        case 0x0011: return wxT("WM_PPAINT");
+        case 0x0012: return wxT("WM_PSETFOCUS");
+        case 0x0013: return wxT("WM_PSYSCOLORCHANGE");
+        case 0x0014: return wxT("WM_PSIZE");
+        case 0x0015: return wxT("WM_PACTIVATE");
+        case 0x0016: return wxT("WM_PCONTROL");
+        case 0x0020: return wxT("WM_COMMAND");
+        case 0x0021: return wxT("WM_SYSCOMMAND");
+        case 0x0022: return wxT("WM_HELP");
+        case 0x0023: return wxT("WM_PAINT");
+        case 0x0024: return wxT("WM_TIMER");
+        case 0x0025: return wxT("WM_SEM1");
+        case 0x0026: return wxT("WM_SEM2");
+        case 0x0027: return wxT("WM_SEM3");
+        case 0x0028: return wxT("WM_SEM4");
+        case 0x0029: return wxT("WM_CLOSE");
+        case 0x002A: return wxT("WM_QUIT");
+        case 0x002B: return wxT("WM_SYSCOLORCHANGE");
+        case 0x002D: return wxT("WM_SYSVALUECHANGE");
+        case 0x002E: return wxT("WM_APPTERMINATENOTIFY");
+        case 0x002F: return wxT("WM_PRESPARAMCHANGED");
         // Control notification messages
         // Control notification messages
-        case 0x0030: return "WM_CONTROL";
-        case 0x0031: return "WM_VSCROLL";
-        case 0x0032: return "WM_HSCROLL";
-        case 0x0033: return "WM_INITMENU";
-        case 0x0034: return "WM_MENUSELECT";
-        case 0x0035: return "WM_MENUSEND";
-        case 0x0036: return "WM_DRAWITEM";
-        case 0x0037: return "WM_MEASUREITEM";
-        case 0x0038: return "WM_CONTROLPOINTER";
-        case 0x003A: return "WM_QUERYDLGCODE";
-        case 0x003B: return "WM_INITDLG";
-        case 0x003C: return "WM_SUBSTITUTESTRING";
-        case 0x003D: return "WM_MATCHMNEMONIC";
-        case 0x003E: return "WM_SAVEAPPLICATION";
-        case 0x0129: return "WM_CTLCOLORCHANGE";
-        case 0x0130: return "WM_QUERYCTLTYPE";
+        case 0x0030: return wxT("WM_CONTROL");
+        case 0x0031: return wxT("WM_VSCROLL");
+        case 0x0032: return wxT("WM_HSCROLL");
+        case 0x0033: return wxT("WM_INITMENU");
+        case 0x0034: return wxT("WM_MENUSELECT");
+        case 0x0035: return wxT("WM_MENUSEND");
+        case 0x0036: return wxT("WM_DRAWITEM");
+        case 0x0037: return wxT("WM_MEASUREITEM");
+        case 0x0038: return wxT("WM_CONTROLPOINTER");
+        case 0x003A: return wxT("WM_QUERYDLGCODE");
+        case 0x003B: return wxT("WM_INITDLG");
+        case 0x003C: return wxT("WM_SUBSTITUTESTRING");
+        case 0x003D: return wxT("WM_MATCHMNEMONIC");
+        case 0x003E: return wxT("WM_SAVEAPPLICATION");
+        case 0x0129: return wxT("WM_CTLCOLORCHANGE");
+        case 0x0130: return wxT("WM_QUERYCTLTYPE");
         // Frame messages
         // Frame messages
-        case 0x0040: return "WM_FLASHWINDOW";
-        case 0x0041: return "WM_FORMATFRAME";
-        case 0x0042: return "WM_UPDATEFRAME";
-        case 0x0043: return "WM_FOCUSCHANGE";
-        case 0x0044: return "WM_SETBORDERSIZE";
-        case 0x0045: return "WM_TRACKFRAME";
-        case 0x0046: return "WM_MINMAXFRAME";
-        case 0x0047: return "WM_SETICON";
-        case 0x0048: return "WM_QUERYICON";
-        case 0x0049: return "WM_SETACCELTABLE";
-        case 0x004A: return "WM_QUERYACCELTABLE";
-        case 0x004B: return "WM_TRANSLATEACCEL";
-        case 0x004C: return "WM_QUERYTRACKINFO";
-        case 0x004D: return "WM_QUERYBORDERSIZE";
-        case 0x004E: return "WM_NEXTMENU";
-        case 0x004F: return "WM_ERASEBACKGROUND";
-        case 0x0050: return "WM_QUERYFRAMEINFO";
-        case 0x0051: return "WM_QUERYFOCUSCHAIN";
-        case 0x0052: return "WM_OWNERPOSCHANGE";
-        case 0x0053: return "WM_CACLFRAMERECT";
-        case 0x0055: return "WM_WINDOWPOSCHANGED";
-        case 0x0056: return "WM_ADJUSTFRAMEPOS";
-        case 0x0059: return "WM_QUERYFRAMECTLCOUNT";
-        case 0x005B: return "WM_QUERYHELPINFO";
-        case 0x005C: return "WM_SETHELPINFO";
-        case 0x005D: return "WM_ERROR";
-        case 0x005E: return "WM_REALIZEPALETTE";
+        case 0x0040: return wxT("WM_FLASHWINDOW");
+        case 0x0041: return wxT("WM_FORMATFRAME");
+        case 0x0042: return wxT("WM_UPDATEFRAME");
+        case 0x0043: return wxT("WM_FOCUSCHANGE");
+        case 0x0044: return wxT("WM_SETBORDERSIZE");
+        case 0x0045: return wxT("WM_TRACKFRAME");
+        case 0x0046: return wxT("WM_MINMAXFRAME");
+        case 0x0047: return wxT("WM_SETICON");
+        case 0x0048: return wxT("WM_QUERYICON");
+        case 0x0049: return wxT("WM_SETACCELTABLE");
+        case 0x004A: return wxT("WM_QUERYACCELTABLE");
+        case 0x004B: return wxT("WM_TRANSLATEACCEL");
+        case 0x004C: return wxT("WM_QUERYTRACKINFO");
+        case 0x004D: return wxT("WM_QUERYBORDERSIZE");
+        case 0x004E: return wxT("WM_NEXTMENU");
+        case 0x004F: return wxT("WM_ERASEBACKGROUND");
+        case 0x0050: return wxT("WM_QUERYFRAMEINFO");
+        case 0x0051: return wxT("WM_QUERYFOCUSCHAIN");
+        case 0x0052: return wxT("WM_OWNERPOSCHANGE");
+        case 0x0053: return wxT("WM_CACLFRAMERECT");
+        case 0x0055: return wxT("WM_WINDOWPOSCHANGED");
+        case 0x0056: return wxT("WM_ADJUSTFRAMEPOS");
+        case 0x0059: return wxT("WM_QUERYFRAMECTLCOUNT");
+        case 0x005B: return wxT("WM_QUERYHELPINFO");
+        case 0x005C: return wxT("WM_SETHELPINFO");
+        case 0x005D: return wxT("WM_ERROR");
+        case 0x005E: return wxT("WM_REALIZEPALETTE");
         // Clipboard messages
         // Clipboard messages
-        case 0x0060: return "WM_RENDERFMT";
-        case 0x0061: return "WM_RENDERALLFMTS";
-        case 0x0062: return "WM_DESTROYCLIPBOARD";
-        case 0x0063: return "WM_PAINTCLIPBOARD";
-        case 0x0064: return "WM_SIZECLIPBOARD";
-        case 0x0065: return "WM_HSCROLLCLIPBOARD";
-        case 0x0066: return "WM_VSCROLLCLIPBOARD";
-        case 0x0067: return "WM_DRAWCLIPBOARD";
+        case 0x0060: return wxT("WM_RENDERFMT");
+        case 0x0061: return wxT("WM_RENDERALLFMTS");
+        case 0x0062: return wxT("WM_DESTROYCLIPBOARD");
+        case 0x0063: return wxT("WM_PAINTCLIPBOARD");
+        case 0x0064: return wxT("WM_SIZECLIPBOARD");
+        case 0x0065: return wxT("WM_HSCROLLCLIPBOARD");
+        case 0x0066: return wxT("WM_VSCROLLCLIPBOARD");
+        case 0x0067: return wxT("WM_DRAWCLIPBOARD");
         // mouse messages
         // mouse messages
-        case 0x0070: return "WM_MOUSEMOVE";
-        case 0x0071: return "WM_BUTTON1DOWN";
-        case 0x0072: return "WM_BUTTON1UP";
-        case 0x0073: return "WM_BUTTON1DBLCLK";
-        case 0x0074: return "WM_BUTTON2DOWN";
-        case 0x0075: return "WM_BUTTON2UP";
-        case 0x0076: return "WM_BUTTON2DBLCLK";
-        case 0x0077: return "WM_BUTTON3DOWN";
-        case 0x0078: return "WM_BUTTON3UP";
-        case 0x0079: return "WM_BUTTON3DBLCLK";
-        case 0x007D: return "WM_MOUSEMAP";
-        case 0x007E: return "WM_VRNDISABLED";
-        case 0x007F: return "WM_VRNENABLED";
-        case 0x0410: return "WM_CHORD";
-        case 0x0411: return "WM_BUTTON1MOTIONSTART";
-        case 0x0412: return "WM_BUTTON1MOTIONEND";
-        case 0x0413: return "WM_BUTTON1CLICK";
-        case 0x0414: return "WM_BUTTON2MOTIONSTART";
-        case 0x0415: return "WM_BUTTON2MOTIONEND";
-        case 0x0416: return "WM_BUTTON2CLICK";
-        case 0x0417: return "WM_BUTTON3MOTIONSTART";
-        case 0x0418: return "WM_BUTTON3MOTIONEND";
-        case 0x0419: return "WM_BUTTON3CLICK";
-        case 0x0420: return "WM_BEGINDRAG";
-        case 0x0421: return "WM_ENDDRAG";
-        case 0x0422: return "WM_SINGLESELECT";
-        case 0x0423: return "WM_OPEN";
-        case 0x0424: return "WM_CONTEXTMENU";
-        case 0x0425: return "WM_CONTEXTHELP";
-        case 0x0426: return "WM_TEXTEDIT";
-        case 0x0427: return "WM_BEGINSELECT";
-        case 0x0228: return "WM_ENDSELECT";
-        case 0x0429: return "WM_PICKUP";
-        case 0x04C0: return "WM_PENFIRST";
-        case 0x04FF: return "WM_PENLAST";
-        case 0x0500: return "WM_MMPMFIRST";
-        case 0x05FF: return "WM_MMPMLAST";
-        case 0x0600: return "WM_STDDLGFIRST";
-        case 0x06FF: return "WM_STDDLGLAST";
-        case 0x0BD0: return "WM_BIDI_FIRST";
-        case 0x0BFF: return "WM_BIDI_LAST";
+        case 0x0070: return wxT("WM_MOUSEMOVE");
+        case 0x0071: return wxT("WM_BUTTON1DOWN");
+        case 0x0072: return wxT("WM_BUTTON1UP");
+        case 0x0073: return wxT("WM_BUTTON1DBLCLK");
+        case 0x0074: return wxT("WM_BUTTON2DOWN");
+        case 0x0075: return wxT("WM_BUTTON2UP");
+        case 0x0076: return wxT("WM_BUTTON2DBLCLK");
+        case 0x0077: return wxT("WM_BUTTON3DOWN");
+        case 0x0078: return wxT("WM_BUTTON3UP");
+        case 0x0079: return wxT("WM_BUTTON3DBLCLK");
+        case 0x007D: return wxT("WM_MOUSEMAP");
+        case 0x007E: return wxT("WM_VRNDISABLED");
+        case 0x007F: return wxT("WM_VRNENABLED");
+        case 0x0410: return wxT("WM_CHORD");
+        case 0x0411: return wxT("WM_BUTTON1MOTIONSTART");
+        case 0x0412: return wxT("WM_BUTTON1MOTIONEND");
+        case 0x0413: return wxT("WM_BUTTON1CLICK");
+        case 0x0414: return wxT("WM_BUTTON2MOTIONSTART");
+        case 0x0415: return wxT("WM_BUTTON2MOTIONEND");
+        case 0x0416: return wxT("WM_BUTTON2CLICK");
+        case 0x0417: return wxT("WM_BUTTON3MOTIONSTART");
+        case 0x0418: return wxT("WM_BUTTON3MOTIONEND");
+        case 0x0419: return wxT("WM_BUTTON3CLICK");
+        case 0x0420: return wxT("WM_BEGINDRAG");
+        case 0x0421: return wxT("WM_ENDDRAG");
+        case 0x0422: return wxT("WM_SINGLESELECT");
+        case 0x0423: return wxT("WM_OPEN");
+        case 0x0424: return wxT("WM_CONTEXTMENU");
+        case 0x0425: return wxT("WM_CONTEXTHELP");
+        case 0x0426: return wxT("WM_TEXTEDIT");
+        case 0x0427: return wxT("WM_BEGINSELECT");
+        case 0x0228: return wxT("WM_ENDSELECT");
+        case 0x0429: return wxT("WM_PICKUP");
+        case 0x04C0: return wxT("WM_PENFIRST");
+        case 0x04FF: return wxT("WM_PENLAST");
+        case 0x0500: return wxT("WM_MMPMFIRST");
+        case 0x05FF: return wxT("WM_MMPMLAST");
+        case 0x0600: return wxT("WM_STDDLGFIRST");
+        case 0x06FF: return wxT("WM_STDDLGLAST");
+        case 0x0BD0: return wxT("WM_BIDI_FIRST");
+        case 0x0BFF: return wxT("WM_BIDI_LAST");
         // keyboard input
         // keyboard input
-        case 0x007A: return "WM_CHAR";
-        case 0x007B: return "WM_VIOCHAR";
+        case 0x007A: return wxT("WM_CHAR");
+        case 0x007B: return wxT("WM_VIOCHAR");
         // DDE messages
         // DDE messages
-        case 0x00A0: return "WM_DDE_INITIATE";
-        case 0x00A1: return "WM_DDE_REQUEST";
-        case 0x00A2: return "WM_DDE_ACK";
-        case 0x00A3: return "WM_DDE_DATA";
-        case 0x00A4: return "WM_DDE_ADVISE";
-        case 0x00A5: return "WM_DDE_UNADVISE";
-        case 0x00A6: return "WM_DDE_POKE";
-        case 0x00A7: return "WM_DDE_EXECUTE";
-        case 0x00A8: return "WM_DDE_TERMINATE";
-        case 0x00A9: return "WM_DDE_INITIATEACK";
-        case 0x00AF: return "WM_DDE_LAST";
+        case 0x00A0: return wxT("WM_DDE_INITIATE");
+        case 0x00A1: return wxT("WM_DDE_REQUEST");
+        case 0x00A2: return wxT("WM_DDE_ACK");
+        case 0x00A3: return wxT("WM_DDE_DATA");
+        case 0x00A4: return wxT("WM_DDE_ADVISE");
+        case 0x00A5: return wxT("WM_DDE_UNADVISE");
+        case 0x00A6: return wxT("WM_DDE_POKE");
+        case 0x00A7: return wxT("WM_DDE_EXECUTE");
+        case 0x00A8: return wxT("WM_DDE_TERMINATE");
+        case 0x00A9: return wxT("WM_DDE_INITIATEACK");
+        case 0x00AF: return wxT("WM_DDE_LAST");
         // Buttons
         // Buttons
-        case 0x0120: return "BM_CLICK";
-        case 0x0121: return "BM_QUERYCHECKINDEX";
-        case 0x0122: return "BM_QUERYHILITE";
-        case 0x0123: return "BM_SETHILITE";
-        case 0x0124: return "BM_QUERYCHECK";
-        case 0x0125: return "BM_SETCHECK";
-        case 0x0126: return "BM_SETDEFAULT";
-        case 0x0128: return "BM_AUTOSIZE";
+        case 0x0120: return wxT("BM_CLICK");
+        case 0x0121: return wxT("BM_QUERYCHECKINDEX");
+        case 0x0122: return wxT("BM_QUERYHILITE");
+        case 0x0123: return wxT("BM_SETHILITE");
+        case 0x0124: return wxT("BM_QUERYCHECK");
+        case 0x0125: return wxT("BM_SETCHECK");
+        case 0x0126: return wxT("BM_SETDEFAULT");
+        case 0x0128: return wxT("BM_AUTOSIZE");
         // Combo boxes
         // Combo boxes
-        case 0x029A: return "CBID_LIST";
-        case 0x029B: return "CBID_EDIT";
-        case 0x0170: return "CBM_SHOWLIST";
-        case 0x0171: return "CBM_HILITE";
-        case 0x0172: return "CBM_ISLISTSHOWING";
+        case 0x029A: return wxT("CBID_LIST");
+        case 0x029B: return wxT("CBID_EDIT");
+        case 0x0170: return wxT("CBM_SHOWLIST");
+        case 0x0171: return wxT("CBM_HILITE");
+        case 0x0172: return wxT("CBM_ISLISTSHOWING");
         // Edit fields
         // Edit fields
-        case 0x0140: return "EM_QUERYCHANGED";
-        case 0x0141: return "EM_QUERYSEL";
-        case 0x0142: return "EM_SETSEL";
-        case 0x0143: return "EM_SETTEXTLIMIT";
-        case 0x0144: return "EM_CUT";
-        case 0x0145: return "EM_COPY";
-        case 0x0146: return "EM_CLEAR";
-        case 0x0147: return "EM_PASTE";
-        case 0x0148: return "EM_QUERYFIRSTCHAR";
-        case 0x0149: return "EM_SETFIRSTCHAR";
-        case 0x014A: return "EM_QUERYREADONLY";
-        case 0x014B: return "EM_SETREADONLY";
-        case 0x014C: return "EM_SETINSERTMODE";
+        case 0x0140: return wxT("EM_QUERYCHANGED");
+        case 0x0141: return wxT("EM_QUERYSEL");
+        case 0x0142: return wxT("EM_SETSEL");
+        case 0x0143: return wxT("EM_SETTEXTLIMIT");
+        case 0x0144: return wxT("EM_CUT");
+        case 0x0145: return wxT("EM_COPY");
+        case 0x0146: return wxT("EM_CLEAR");
+        case 0x0147: return wxT("EM_PASTE");
+        case 0x0148: return wxT("EM_QUERYFIRSTCHAR");
+        case 0x0149: return wxT("EM_SETFIRSTCHAR");
+        case 0x014A: return wxT("EM_QUERYREADONLY");
+        case 0x014B: return wxT("EM_SETREADONLY");
+        case 0x014C: return wxT("EM_SETINSERTMODE");
         // Listboxes
         // Listboxes
-        case 0x0160: return "LM_QUERYITEMCOUNT";
-        case 0x0161: return "LM_INSERTITEM";
-        case 0x0162: return "LM_SETOPENINDEX";
-        case 0x0163: return "LM_DELETEITEM";
-        case 0x0164: return "LM_SELECTITEM";
-        case 0x0165: return "LM_QUERYSELECTION";
-        case 0x0166: return "LM_SETITEMTEXT";
-        case 0x0167: return "LM_QUERYITEMTEXTLENGTH";
-        case 0x0168: return "LM_QUERYITEMTEXT";
-        case 0x0169: return "LM_SETITEMHANDLE";
-        case 0x016A: return "LM_QUERYITEMHANDLE";
-        case 0x016B: return "LM_SEARCHSTRING";
-        case 0x016C: return "LM_SETITEMHEIGHT";
-        case 0x016D: return "LM_QUERYTOPINDEX";
-        case 0x016E: return "LM_DELETEALL";
-        case 0x016F: return "LM_INSERTMULITEMS";
-        case 0x0660: return "LM_SETITEMWIDTH";
+        case 0x0160: return wxT("LM_QUERYITEMCOUNT");
+        case 0x0161: return wxT("LM_INSERTITEM");
+        case 0x0162: return wxT("LM_SETOPENINDEX");
+        case 0x0163: return wxT("LM_DELETEITEM");
+        case 0x0164: return wxT("LM_SELECTITEM");
+        case 0x0165: return wxT("LM_QUERYSELECTION");
+        case 0x0166: return wxT("LM_SETITEMTEXT");
+        case 0x0167: return wxT("LM_QUERYITEMTEXTLENGTH");
+        case 0x0168: return wxT("LM_QUERYITEMTEXT");
+        case 0x0169: return wxT("LM_SETITEMHANDLE");
+        case 0x016A: return wxT("LM_QUERYITEMHANDLE");
+        case 0x016B: return wxT("LM_SEARCHSTRING");
+        case 0x016C: return wxT("LM_SETITEMHEIGHT");
+        case 0x016D: return wxT("LM_QUERYTOPINDEX");
+        case 0x016E: return wxT("LM_DELETEALL");
+        case 0x016F: return wxT("LM_INSERTMULITEMS");
+        case 0x0660: return wxT("LM_SETITEMWIDTH");
         // Menus
         // Menus
-        case 0x0180: return "MM_INSERTITEM";
-        case 0x0181: return "MM_DELETEITEM";
-        case 0x0182: return "MM_QUERYITEM";
-        case 0x0183: return "MM_SETITEM";
-        case 0x0184: return "MM_QUERYITEMCOUNT";
-        case 0x0185: return "MM_STARTMENUMODE";
-        case 0x0186: return "MM_ENDMENUMODE";
-        case 0x0188: return "MM_REMOVEITEM";
-        case 0x0189: return "MM_SELECTITEM";
-        case 0x018A: return "MM_QUERYSELITEMID";
-        case 0x018B: return "MM_QUERYITEMTEXT";
-        case 0x018C: return "MM_QUERYITEMTEXTLENGTH";
-        case 0x018D: return "MM_SETITEMHANDLE";
-        case 0x018E: return "MM_SETITEMTEXT";
-        case 0x018F: return "MM_ITEMPOSITIONFROMID";
-        case 0x0190: return "MM_ITEMIDFROMPOSITION";
-        case 0x0191: return "MM_QUERYITEMATTR";
-        case 0x0192: return "MM_SETITEMATTR";
-        case 0x0193: return "MM_ISITEMVALID";
-        case 0x0194: return "MM_QUERYITEMRECT";
-        case 0x0431: return "MM_QUERYDEFAULTITEMID";
-        case 0x0432: return "MM_SETDEFAULTITEMID";
+        case 0x0180: return wxT("MM_INSERTITEM");
+        case 0x0181: return wxT("MM_DELETEITEM");
+        case 0x0182: return wxT("MM_QUERYITEM");
+        case 0x0183: return wxT("MM_SETITEM");
+        case 0x0184: return wxT("MM_QUERYITEMCOUNT");
+        case 0x0185: return wxT("MM_STARTMENUMODE");
+        case 0x0186: return wxT("MM_ENDMENUMODE");
+        case 0x0188: return wxT("MM_REMOVEITEM");
+        case 0x0189: return wxT("MM_SELECTITEM");
+        case 0x018A: return wxT("MM_QUERYSELITEMID");
+        case 0x018B: return wxT("MM_QUERYITEMTEXT");
+        case 0x018C: return wxT("MM_QUERYITEMTEXTLENGTH");
+        case 0x018D: return wxT("MM_SETITEMHANDLE");
+        case 0x018E: return wxT("MM_SETITEMTEXT");
+        case 0x018F: return wxT("MM_ITEMPOSITIONFROMID");
+        case 0x0190: return wxT("MM_ITEMIDFROMPOSITION");
+        case 0x0191: return wxT("MM_QUERYITEMATTR");
+        case 0x0192: return wxT("MM_SETITEMATTR");
+        case 0x0193: return wxT("MM_ISITEMVALID");
+        case 0x0194: return wxT("MM_QUERYITEMRECT");
+        case 0x0431: return wxT("MM_QUERYDEFAULTITEMID");
+        case 0x0432: return wxT("MM_SETDEFAULTITEMID");
         // Scrollbars
         // Scrollbars
-        case 0x01A0: return "SBM_SETSCROLLBAR";
-        case 0x01A1: return "SBM_SETPOS";
-        case 0x01A2: return "SBM_QUERYPOS";
-        case 0x01A3: return "SBM_QUERYRANGE";
-        case 0x01A6: return "SBM_SETTHUMBSIZE";
+        case 0x01A0: return wxT("SBM_SETSCROLLBAR");
+        case 0x01A1: return wxT("SBM_SETPOS");
+        case 0x01A2: return wxT("SBM_QUERYPOS");
+        case 0x01A3: return wxT("SBM_QUERYRANGE");
+        case 0x01A6: return wxT("SBM_SETTHUMBSIZE");
 
         // Help messages
 
         // Help messages
-        case 0x0F00: return "WM_HELPBASE";
-        case 0x0FFF: return "WM_HELPTOP";
+        case 0x0F00: return wxT("WM_HELPBASE");
+        case 0x0FFF: return wxT("WM_HELPTOP");
         // Beginning of user defined messages
         // Beginning of user defined messages
-        case 0x1000: return "WM_USER";
+        case 0x1000: return wxT("WM_USER");
 
         // wxWidgets user defined types
 
         // listview
 
         // wxWidgets user defined types
 
         // listview
-        // case 0x1000 + 0: return "LVM_GETBKCOLOR";
-        case 0x1000 + 1: return "LVM_SETBKCOLOR";
-        case 0x1000 + 2: return "LVM_GETIMAGELIST";
-        case 0x1000 + 3: return "LVM_SETIMAGELIST";
-        case 0x1000 + 4: return "LVM_GETITEMCOUNT";
-        case 0x1000 + 5: return "LVM_GETITEMA";
-        case 0x1000 + 75: return "LVM_GETITEMW";
-        case 0x1000 + 6: return "LVM_SETITEMA";
-        case 0x1000 + 76: return "LVM_SETITEMW";
-        case 0x1000 + 7: return "LVM_INSERTITEMA";
-        case 0x1000 + 77: return "LVM_INSERTITEMW";
-        case 0x1000 + 8: return "LVM_DELETEITEM";
-        case 0x1000 + 9: return "LVM_DELETEALLITEMS";
-        case 0x1000 + 10: return "LVM_GETCALLBACKMASK";
-        case 0x1000 + 11: return "LVM_SETCALLBACKMASK";
-        case 0x1000 + 12: return "LVM_GETNEXTITEM";
-        case 0x1000 + 13: return "LVM_FINDITEMA";
-        case 0x1000 + 83: return "LVM_FINDITEMW";
-        case 0x1000 + 14: return "LVM_GETITEMRECT";
-        case 0x1000 + 15: return "LVM_SETITEMPOSITION";
-        case 0x1000 + 16: return "LVM_GETITEMPOSITION";
-        case 0x1000 + 17: return "LVM_GETSTRINGWIDTHA";
-        case 0x1000 + 87: return "LVM_GETSTRINGWIDTHW";
-        case 0x1000 + 18: return "LVM_HITTEST";
-        case 0x1000 + 19: return "LVM_ENSUREVISIBLE";
-        case 0x1000 + 20: return "LVM_SCROLL";
-        case 0x1000 + 21: return "LVM_REDRAWITEMS";
-        case 0x1000 + 22: return "LVM_ARRANGE";
-        case 0x1000 + 23: return "LVM_EDITLABELA";
-        case 0x1000 + 118: return "LVM_EDITLABELW";
-        case 0x1000 + 24: return "LVM_GETEDITCONTROL";
-        case 0x1000 + 25: return "LVM_GETCOLUMNA";
-        case 0x1000 + 95: return "LVM_GETCOLUMNW";
-        case 0x1000 + 26: return "LVM_SETCOLUMNA";
-        case 0x1000 + 96: return "LVM_SETCOLUMNW";
-        case 0x1000 + 27: return "LVM_INSERTCOLUMNA";
-        case 0x1000 + 97: return "LVM_INSERTCOLUMNW";
-        case 0x1000 + 28: return "LVM_DELETECOLUMN";
-        case 0x1000 + 29: return "LVM_GETCOLUMNWIDTH";
-        case 0x1000 + 30: return "LVM_SETCOLUMNWIDTH";
-        case 0x1000 + 31: return "LVM_GETHEADER";
-        case 0x1000 + 33: return "LVM_CREATEDRAGIMAGE";
-        case 0x1000 + 34: return "LVM_GETVIEWRECT";
-        case 0x1000 + 35: return "LVM_GETTEXTCOLOR";
-        case 0x1000 + 36: return "LVM_SETTEXTCOLOR";
-        case 0x1000 + 37: return "LVM_GETTEXTBKCOLOR";
-        case 0x1000 + 38: return "LVM_SETTEXTBKCOLOR";
-        case 0x1000 + 39: return "LVM_GETTOPINDEX";
-        case 0x1000 + 40: return "LVM_GETCOUNTPERPAGE";
-        case 0x1000 + 41: return "LVM_GETORIGIN";
-        case 0x1000 + 42: return "LVM_UPDATE";
-        case 0x1000 + 43: return "LVM_SETITEMSTATE";
-        case 0x1000 + 44: return "LVM_GETITEMSTATE";
-        case 0x1000 + 45: return "LVM_GETITEMTEXTA";
-        case 0x1000 + 115: return "LVM_GETITEMTEXTW";
-        case 0x1000 + 46: return "LVM_SETITEMTEXTA";
-        case 0x1000 + 116: return "LVM_SETITEMTEXTW";
-        case 0x1000 + 47: return "LVM_SETITEMCOUNT";
-        case 0x1000 + 48: return "LVM_SORTITEMS";
-        case 0x1000 + 49: return "LVM_SETITEMPOSITION32";
-        case 0x1000 + 50: return "LVM_GETSELECTEDCOUNT";
-        case 0x1000 + 51: return "LVM_GETITEMSPACING";
-        case 0x1000 + 52: return "LVM_GETISEARCHSTRINGA";
-        case 0x1000 + 117: return "LVM_GETISEARCHSTRINGW";
-        case 0x1000 + 53: return "LVM_SETICONSPACING";
-        case 0x1000 + 54: return "LVM_SETEXTENDEDLISTVIEWSTYLE";
-        case 0x1000 + 55: return "LVM_GETEXTENDEDLISTVIEWSTYLE";
-        case 0x1000 + 56: return "LVM_GETSUBITEMRECT";
-        case 0x1000 + 57: return "LVM_SUBITEMHITTEST";
-        case 0x1000 + 58: return "LVM_SETCOLUMNORDERARRAY";
-        case 0x1000 + 59: return "LVM_GETCOLUMNORDERARRAY";
-        case 0x1000 + 60: return "LVM_SETHOTITEM";
-        case 0x1000 + 61: return "LVM_GETHOTITEM";
-        case 0x1000 + 62: return "LVM_SETHOTCURSOR";
-        case 0x1000 + 63: return "LVM_GETHOTCURSOR";
-        case 0x1000 + 64: return "LVM_APPROXIMATEVIEWRECT";
-        case 0x1000 + 65: return "LVM_SETWORKAREA";
+        // case 0x1000 + 0: return wxT("LVM_GETBKCOLOR");
+        case 0x1000 + 1: return wxT("LVM_SETBKCOLOR");
+        case 0x1000 + 2: return wxT("LVM_GETIMAGELIST");
+        case 0x1000 + 3: return wxT("LVM_SETIMAGELIST");
+        case 0x1000 + 4: return wxT("LVM_GETITEMCOUNT");
+        case 0x1000 + 5: return wxT("LVM_GETITEMA");
+        case 0x1000 + 75: return wxT("LVM_GETITEMW");
+        case 0x1000 + 6: return wxT("LVM_SETITEMA");
+        case 0x1000 + 76: return wxT("LVM_SETITEMW");
+        case 0x1000 + 7: return wxT("LVM_INSERTITEMA");
+        case 0x1000 + 77: return wxT("LVM_INSERTITEMW");
+        case 0x1000 + 8: return wxT("LVM_DELETEITEM");
+        case 0x1000 + 9: return wxT("LVM_DELETEALLITEMS");
+        case 0x1000 + 10: return wxT("LVM_GETCALLBACKMASK");
+        case 0x1000 + 11: return wxT("LVM_SETCALLBACKMASK");
+        case 0x1000 + 12: return wxT("LVM_GETNEXTITEM");
+        case 0x1000 + 13: return wxT("LVM_FINDITEMA");
+        case 0x1000 + 83: return wxT("LVM_FINDITEMW");
+        case 0x1000 + 14: return wxT("LVM_GETITEMRECT");
+        case 0x1000 + 15: return wxT("LVM_SETITEMPOSITION");
+        case 0x1000 + 16: return wxT("LVM_GETITEMPOSITION");
+        case 0x1000 + 17: return wxT("LVM_GETSTRINGWIDTHA");
+        case 0x1000 + 87: return wxT("LVM_GETSTRINGWIDTHW");
+        case 0x1000 + 18: return wxT("LVM_HITTEST");
+        case 0x1000 + 19: return wxT("LVM_ENSUREVISIBLE");
+        case 0x1000 + 20: return wxT("LVM_SCROLL");
+        case 0x1000 + 21: return wxT("LVM_REDRAWITEMS");
+        case 0x1000 + 22: return wxT("LVM_ARRANGE");
+        case 0x1000 + 23: return wxT("LVM_EDITLABELA");
+        case 0x1000 + 118: return wxT("LVM_EDITLABELW");
+        case 0x1000 + 24: return wxT("LVM_GETEDITCONTROL");
+        case 0x1000 + 25: return wxT("LVM_GETCOLUMNA");
+        case 0x1000 + 95: return wxT("LVM_GETCOLUMNW");
+        case 0x1000 + 26: return wxT("LVM_SETCOLUMNA");
+        case 0x1000 + 96: return wxT("LVM_SETCOLUMNW");
+        case 0x1000 + 27: return wxT("LVM_INSERTCOLUMNA");
+        case 0x1000 + 97: return wxT("LVM_INSERTCOLUMNW");
+        case 0x1000 + 28: return wxT("LVM_DELETECOLUMN");
+        case 0x1000 + 29: return wxT("LVM_GETCOLUMNWIDTH");
+        case 0x1000 + 30: return wxT("LVM_SETCOLUMNWIDTH");
+        case 0x1000 + 31: return wxT("LVM_GETHEADER");
+        case 0x1000 + 33: return wxT("LVM_CREATEDRAGIMAGE");
+        case 0x1000 + 34: return wxT("LVM_GETVIEWRECT");
+        case 0x1000 + 35: return wxT("LVM_GETTEXTCOLOR");
+        case 0x1000 + 36: return wxT("LVM_SETTEXTCOLOR");
+        case 0x1000 + 37: return wxT("LVM_GETTEXTBKCOLOR");
+        case 0x1000 + 38: return wxT("LVM_SETTEXTBKCOLOR");
+        case 0x1000 + 39: return wxT("LVM_GETTOPINDEX");
+        case 0x1000 + 40: return wxT("LVM_GETCOUNTPERPAGE");
+        case 0x1000 + 41: return wxT("LVM_GETORIGIN");
+        case 0x1000 + 42: return wxT("LVM_UPDATE");
+        case 0x1000 + 43: return wxT("LVM_SETITEMSTATE");
+        case 0x1000 + 44: return wxT("LVM_GETITEMSTATE");
+        case 0x1000 + 45: return wxT("LVM_GETITEMTEXTA");
+        case 0x1000 + 115: return wxT("LVM_GETITEMTEXTW");
+        case 0x1000 + 46: return wxT("LVM_SETITEMTEXTA");
+        case 0x1000 + 116: return wxT("LVM_SETITEMTEXTW");
+        case 0x1000 + 47: return wxT("LVM_SETITEMCOUNT");
+        case 0x1000 + 48: return wxT("LVM_SORTITEMS");
+        case 0x1000 + 49: return wxT("LVM_SETITEMPOSITION32");
+        case 0x1000 + 50: return wxT("LVM_GETSELECTEDCOUNT");
+        case 0x1000 + 51: return wxT("LVM_GETITEMSPACING");
+        case 0x1000 + 52: return wxT("LVM_GETISEARCHSTRINGA");
+        case 0x1000 + 117: return wxT("LVM_GETISEARCHSTRINGW");
+        case 0x1000 + 53: return wxT("LVM_SETICONSPACING");
+        case 0x1000 + 54: return wxT("LVM_SETEXTENDEDLISTVIEWSTYLE");
+        case 0x1000 + 55: return wxT("LVM_GETEXTENDEDLISTVIEWSTYLE");
+        case 0x1000 + 56: return wxT("LVM_GETSUBITEMRECT");
+        case 0x1000 + 57: return wxT("LVM_SUBITEMHITTEST");
+        case 0x1000 + 58: return wxT("LVM_SETCOLUMNORDERARRAY");
+        case 0x1000 + 59: return wxT("LVM_GETCOLUMNORDERARRAY");
+        case 0x1000 + 60: return wxT("LVM_SETHOTITEM");
+        case 0x1000 + 61: return wxT("LVM_GETHOTITEM");
+        case 0x1000 + 62: return wxT("LVM_SETHOTCURSOR");
+        case 0x1000 + 63: return wxT("LVM_GETHOTCURSOR");
+        case 0x1000 + 64: return wxT("LVM_APPROXIMATEVIEWRECT");
+        case 0x1000 + 65: return wxT("LVM_SETWORKAREA");
 
         // tree view
 
         // tree view
-        case 0x1100 + 0: return "TVM_INSERTITEMA";
-        case 0x1100 + 50: return "TVM_INSERTITEMW";
-        case 0x1100 + 1: return "TVM_DELETEITEM";
-        case 0x1100 + 2: return "TVM_EXPAND";
-        case 0x1100 + 4: return "TVM_GETITEMRECT";
-        case 0x1100 + 5: return "TVM_GETCOUNT";
-        case 0x1100 + 6: return "TVM_GETINDENT";
-        case 0x1100 + 7: return "TVM_SETINDENT";
-        case 0x1100 + 8: return "TVM_GETIMAGELIST";
-        case 0x1100 + 9: return "TVM_SETIMAGELIST";
-        case 0x1100 + 10: return "TVM_GETNEXTITEM";
-        case 0x1100 + 11: return "TVM_SELECTITEM";
-        case 0x1100 + 12: return "TVM_GETITEMA";
-        case 0x1100 + 62: return "TVM_GETITEMW";
-        case 0x1100 + 13: return "TVM_SETITEMA";
-        case 0x1100 + 63: return "TVM_SETITEMW";
-        case 0x1100 + 14: return "TVM_EDITLABELA";
-        case 0x1100 + 65: return "TVM_EDITLABELW";
-        case 0x1100 + 15: return "TVM_GETEDITCONTROL";
-        case 0x1100 + 16: return "TVM_GETVISIBLECOUNT";
-        case 0x1100 + 17: return "TVM_HITTEST";
-        case 0x1100 + 18: return "TVM_CREATEDRAGIMAGE";
-        case 0x1100 + 19: return "TVM_SORTCHILDREN";
-        case 0x1100 + 20: return "TVM_ENSUREVISIBLE";
-        case 0x1100 + 21: return "TVM_SORTCHILDRENCB";
-        case 0x1100 + 22: return "TVM_ENDEDITLABELNOW";
-        case 0x1100 + 23: return "TVM_GETISEARCHSTRINGA";
-        case 0x1100 + 64: return "TVM_GETISEARCHSTRINGW";
-        case 0x1100 + 24: return "TVM_SETTOOLTIPS";
-        case 0x1100 + 25: return "TVM_GETTOOLTIPS";
+        case 0x1100 + 0: return wxT("TVM_INSERTITEMA");
+        case 0x1100 + 50: return wxT("TVM_INSERTITEMW");
+        case 0x1100 + 1: return wxT("TVM_DELETEITEM");
+        case 0x1100 + 2: return wxT("TVM_EXPAND");
+        case 0x1100 + 4: return wxT("TVM_GETITEMRECT");
+        case 0x1100 + 5: return wxT("TVM_GETCOUNT");
+        case 0x1100 + 6: return wxT("TVM_GETINDENT");
+        case 0x1100 + 7: return wxT("TVM_SETINDENT");
+        case 0x1100 + 8: return wxT("TVM_GETIMAGELIST");
+        case 0x1100 + 9: return wxT("TVM_SETIMAGELIST");
+        case 0x1100 + 10: return wxT("TVM_GETNEXTITEM");
+        case 0x1100 + 11: return wxT("TVM_SELECTITEM");
+        case 0x1100 + 12: return wxT("TVM_GETITEMA");
+        case 0x1100 + 62: return wxT("TVM_GETITEMW");
+        case 0x1100 + 13: return wxT("TVM_SETITEMA");
+        case 0x1100 + 63: return wxT("TVM_SETITEMW");
+        case 0x1100 + 14: return wxT("TVM_EDITLABELA");
+        case 0x1100 + 65: return wxT("TVM_EDITLABELW");
+        case 0x1100 + 15: return wxT("TVM_GETEDITCONTROL");
+        case 0x1100 + 16: return wxT("TVM_GETVISIBLECOUNT");
+        case 0x1100 + 17: return wxT("TVM_HITTEST");
+        case 0x1100 + 18: return wxT("TVM_CREATEDRAGIMAGE");
+        case 0x1100 + 19: return wxT("TVM_SORTCHILDREN");
+        case 0x1100 + 20: return wxT("TVM_ENSUREVISIBLE");
+        case 0x1100 + 21: return wxT("TVM_SORTCHILDRENCB");
+        case 0x1100 + 22: return wxT("TVM_ENDEDITLABELNOW");
+        case 0x1100 + 23: return wxT("TVM_GETISEARCHSTRINGA");
+        case 0x1100 + 64: return wxT("TVM_GETISEARCHSTRINGW");
+        case 0x1100 + 24: return wxT("TVM_SETTOOLTIPS");
+        case 0x1100 + 25: return wxT("TVM_GETTOOLTIPS");
 
         // header
 
         // header
-        case 0x1200 + 0: return "HDM_GETITEMCOUNT";
-        case 0x1200 + 1: return "HDM_INSERTITEMA";
-        case 0x1200 + 10: return "HDM_INSERTITEMW";
-        case 0x1200 + 2: return "HDM_DELETEITEM";
-        case 0x1200 + 3: return "HDM_GETITEMA";
-        case 0x1200 + 11: return "HDM_GETITEMW";
-        case 0x1200 + 4: return "HDM_SETITEMA";
-        case 0x1200 + 12: return "HDM_SETITEMW";
-        case 0x1200 + 5: return "HDM_LAYOUT";
-        case 0x1200 + 6: return "HDM_HITTEST";
-        case 0x1200 + 7: return "HDM_GETITEMRECT";
-        case 0x1200 + 8: return "HDM_SETIMAGELIST";
-        case 0x1200 + 9: return "HDM_GETIMAGELIST";
-        case 0x1200 + 15: return "HDM_ORDERTOINDEX";
-        case 0x1200 + 16: return "HDM_CREATEDRAGIMAGE";
-        case 0x1200 + 17: return "HDM_GETORDERARRAY";
-        case 0x1200 + 18: return "HDM_SETORDERARRAY";
-        case 0x1200 + 19: return "HDM_SETHOTDIVIDER";
+        case 0x1200 + 0: return wxT("HDM_GETITEMCOUNT");
+        case 0x1200 + 1: return wxT("HDM_INSERTITEMA");
+        case 0x1200 + 10: return wxT("HDM_INSERTITEMW");
+        case 0x1200 + 2: return wxT("HDM_DELETEITEM");
+        case 0x1200 + 3: return wxT("HDM_GETITEMA");
+        case 0x1200 + 11: return wxT("HDM_GETITEMW");
+        case 0x1200 + 4: return wxT("HDM_SETITEMA");
+        case 0x1200 + 12: return wxT("HDM_SETITEMW");
+        case 0x1200 + 5: return wxT("HDM_LAYOUT");
+        case 0x1200 + 6: return wxT("HDM_HITTEST");
+        case 0x1200 + 7: return wxT("HDM_GETITEMRECT");
+        case 0x1200 + 8: return wxT("HDM_SETIMAGELIST");
+        case 0x1200 + 9: return wxT("HDM_GETIMAGELIST");
+        case 0x1200 + 15: return wxT("HDM_ORDERTOINDEX");
+        case 0x1200 + 16: return wxT("HDM_CREATEDRAGIMAGE");
+        case 0x1200 + 17: return wxT("HDM_GETORDERARRAY");
+        case 0x1200 + 18: return wxT("HDM_SETORDERARRAY");
+        case 0x1200 + 19: return wxT("HDM_SETHOTDIVIDER");
 
         // tab control
 
         // tab control
-        case 0x1300 + 2: return "TCM_GETIMAGELIST";
-        case 0x1300 + 3: return "TCM_SETIMAGELIST";
-        case 0x1300 + 4: return "TCM_GETITEMCOUNT";
-        case 0x1300 + 5: return "TCM_GETITEMA";
-        case 0x1300 + 60: return "TCM_GETITEMW";
-        case 0x1300 + 6: return "TCM_SETITEMA";
-        case 0x1300 + 61: return "TCM_SETITEMW";
-        case 0x1300 + 7: return "TCM_INSERTITEMA";
-        case 0x1300 + 62: return "TCM_INSERTITEMW";
-        case 0x1300 + 8: return "TCM_DELETEITEM";
-        case 0x1300 + 9: return "TCM_DELETEALLITEMS";
-        case 0x1300 + 10: return "TCM_GETITEMRECT";
-        case 0x1300 + 11: return "TCM_GETCURSEL";
-        case 0x1300 + 12: return "TCM_SETCURSEL";
-        case 0x1300 + 13: return "TCM_HITTEST";
-        case 0x1300 + 14: return "TCM_SETITEMEXTRA";
-        case 0x1300 + 40: return "TCM_ADJUSTRECT";
-        case 0x1300 + 41: return "TCM_SETITEMSIZE";
-        case 0x1300 + 42: return "TCM_REMOVEIMAGE";
-        case 0x1300 + 43: return "TCM_SETPADDING";
-        case 0x1300 + 44: return "TCM_GETROWCOUNT";
-        case 0x1300 + 45: return "TCM_GETTOOLTIPS";
-        case 0x1300 + 46: return "TCM_SETTOOLTIPS";
-        case 0x1300 + 47: return "TCM_GETCURFOCUS";
-        case 0x1300 + 48: return "TCM_SETCURFOCUS";
-        case 0x1300 + 49: return "TCM_SETMINTABWIDTH";
-        case 0x1300 + 50: return "TCM_DESELECTALL";
+        case 0x1300 + 2: return wxT("TCM_GETIMAGELIST");
+        case 0x1300 + 3: return wxT("TCM_SETIMAGELIST");
+        case 0x1300 + 4: return wxT("TCM_GETITEMCOUNT");
+        case 0x1300 + 5: return wxT("TCM_GETITEMA");
+        case 0x1300 + 60: return wxT("TCM_GETITEMW");
+        case 0x1300 + 6: return wxT("TCM_SETITEMA");
+        case 0x1300 + 61: return wxT("TCM_SETITEMW");
+        case 0x1300 + 7: return wxT("TCM_INSERTITEMA");
+        case 0x1300 + 62: return wxT("TCM_INSERTITEMW");
+        case 0x1300 + 8: return wxT("TCM_DELETEITEM");
+        case 0x1300 + 9: return wxT("TCM_DELETEALLITEMS");
+        case 0x1300 + 10: return wxT("TCM_GETITEMRECT");
+        case 0x1300 + 11: return wxT("TCM_GETCURSEL");
+        case 0x1300 + 12: return wxT("TCM_SETCURSEL");
+        case 0x1300 + 13: return wxT("TCM_HITTEST");
+        case 0x1300 + 14: return wxT("TCM_SETITEMEXTRA");
+        case 0x1300 + 40: return wxT("TCM_ADJUSTRECT");
+        case 0x1300 + 41: return wxT("TCM_SETITEMSIZE");
+        case 0x1300 + 42: return wxT("TCM_REMOVEIMAGE");
+        case 0x1300 + 43: return wxT("TCM_SETPADDING");
+        case 0x1300 + 44: return wxT("TCM_GETROWCOUNT");
+        case 0x1300 + 45: return wxT("TCM_GETTOOLTIPS");
+        case 0x1300 + 46: return wxT("TCM_SETTOOLTIPS");
+        case 0x1300 + 47: return wxT("TCM_GETCURFOCUS");
+        case 0x1300 + 48: return wxT("TCM_SETCURFOCUS");
+        case 0x1300 + 49: return wxT("TCM_SETMINTABWIDTH");
+        case 0x1300 + 50: return wxT("TCM_DESELECTALL");
 
         // toolbar
 
         // toolbar
-        case WM_USER+1000+1: return "TB_ENABLEBUTTON";
-        case WM_USER+1000+2: return "TB_CHECKBUTTON";
-        case WM_USER+1000+3: return "TB_PRESSBUTTON";
-        case WM_USER+1000+4: return "TB_HIDEBUTTON";
-        case WM_USER+1000+5: return "TB_INDETERMINATE";
-        case WM_USER+1000+9: return "TB_ISBUTTONENABLED";
-        case WM_USER+1000+10: return "TB_ISBUTTONCHECKED";
-        case WM_USER+1000+11: return "TB_ISBUTTONPRESSED";
-        case WM_USER+1000+12: return "TB_ISBUTTONHIDDEN";
-        case WM_USER+1000+13: return "TB_ISBUTTONINDETERMINATE";
-        case WM_USER+1000+17: return "TB_SETSTATE";
-        case WM_USER+1000+18: return "TB_GETSTATE";
-        case WM_USER+1000+19: return "TB_ADDBITMAP";
-        case WM_USER+1000+20: return "TB_ADDBUTTONS";
-        case WM_USER+1000+21: return "TB_INSERTBUTTON";
-        case WM_USER+1000+22: return "TB_DELETEBUTTON";
-        case WM_USER+1000+23: return "TB_GETBUTTON";
-        case WM_USER+1000+24: return "TB_BUTTONCOUNT";
-        case WM_USER+1000+25: return "TB_COMMANDTOINDEX";
-        case WM_USER+1000+26: return "TB_SAVERESTOREA";
-        case WM_USER+1000+76: return "TB_SAVERESTOREW";
-        case WM_USER+1000+27: return "TB_CUSTOMIZE";
-        case WM_USER+1000+28: return "TB_ADDSTRINGA";
-        case WM_USER+1000+77: return "TB_ADDSTRINGW";
-        case WM_USER+1000+29: return "TB_GETITEMRECT";
-        case WM_USER+1000+30: return "TB_BUTTONSTRUCTSIZE";
-        case WM_USER+1000+31: return "TB_SETBUTTONSIZE";
-        case WM_USER+1000+32: return "TB_SETBITMAPSIZE";
-        case WM_USER+1000+33: return "TB_AUTOSIZE";
-        case WM_USER+1000+35: return "TB_GETTOOLTIPS";
-        case WM_USER+1000+36: return "TB_SETTOOLTIPS";
-        case WM_USER+1000+37: return "TB_SETPARENT";
-        case WM_USER+1000+39: return "TB_SETROWS";
-        case WM_USER+1000+40: return "TB_GETROWS";
-        case WM_USER+1000+42: return "TB_SETCMDID";
-        case WM_USER+1000+43: return "TB_CHANGEBITMAP";
-        case WM_USER+1000+44: return "TB_GETBITMAP";
-        case WM_USER+1000+45: return "TB_GETBUTTONTEXTA";
-        case WM_USER+1000+75: return "TB_GETBUTTONTEXTW";
-        case WM_USER+1000+46: return "TB_REPLACEBITMAP";
-        case WM_USER+1000+47: return "TB_SETINDENT";
-        case WM_USER+1000+48: return "TB_SETIMAGELIST";
-        case WM_USER+1000+49: return "TB_GETIMAGELIST";
-        case WM_USER+1000+50: return "TB_LOADIMAGES";
-        case WM_USER+1000+51: return "TB_GETRECT";
-        case WM_USER+1000+52: return "TB_SETHOTIMAGELIST";
-        case WM_USER+1000+53: return "TB_GETHOTIMAGELIST";
-        case WM_USER+1000+54: return "TB_SETDISABLEDIMAGELIST";
-        case WM_USER+1000+55: return "TB_GETDISABLEDIMAGELIST";
-        case WM_USER+1000+56: return "TB_SETSTYLE";
-        case WM_USER+1000+57: return "TB_GETSTYLE";
-        case WM_USER+1000+58: return "TB_GETBUTTONSIZE";
-        case WM_USER+1000+59: return "TB_SETBUTTONWIDTH";
-        case WM_USER+1000+60: return "TB_SETMAXTEXTROWS";
-        case WM_USER+1000+61: return "TB_GETTEXTROWS";
-        case WM_USER+1000+41: return "TB_GETBITMAPFLAGS";
-
-        default:
-            static char s_szBuf[128];
-            sprintf(s_szBuf, "<unknown message = %d>", nMessage);
-            return s_szBuf;
+        case WM_USER+1000+1: return wxT("TB_ENABLEBUTTON");
+        case WM_USER+1000+2: return wxT("TB_CHECKBUTTON");
+        case WM_USER+1000+3: return wxT("TB_PRESSBUTTON");
+        case WM_USER+1000+4: return wxT("TB_HIDEBUTTON");
+        case WM_USER+1000+5: return wxT("TB_INDETERMINATE");
+        case WM_USER+1000+9: return wxT("TB_ISBUTTONENABLED");
+        case WM_USER+1000+10: return wxT("TB_ISBUTTONCHECKED");
+        case WM_USER+1000+11: return wxT("TB_ISBUTTONPRESSED");
+        case WM_USER+1000+12: return wxT("TB_ISBUTTONHIDDEN");
+        case WM_USER+1000+13: return wxT("TB_ISBUTTONINDETERMINATE");
+        case WM_USER+1000+17: return wxT("TB_SETSTATE");
+        case WM_USER+1000+18: return wxT("TB_GETSTATE");
+        case WM_USER+1000+19: return wxT("TB_ADDBITMAP");
+        case WM_USER+1000+20: return wxT("TB_ADDBUTTONS");
+        case WM_USER+1000+21: return wxT("TB_INSERTBUTTON");
+        case WM_USER+1000+22: return wxT("TB_DELETEBUTTON");
+        case WM_USER+1000+23: return wxT("TB_GETBUTTON");
+        case WM_USER+1000+24: return wxT("TB_BUTTONCOUNT");
+        case WM_USER+1000+25: return wxT("TB_COMMANDTOINDEX");
+        case WM_USER+1000+26: return wxT("TB_SAVERESTOREA");
+        case WM_USER+1000+76: return wxT("TB_SAVERESTOREW");
+        case WM_USER+1000+27: return wxT("TB_CUSTOMIZE");
+        case WM_USER+1000+28: return wxT("TB_ADDSTRINGA");
+        case WM_USER+1000+77: return wxT("TB_ADDSTRINGW");
+        case WM_USER+1000+29: return wxT("TB_GETITEMRECT");
+        case WM_USER+1000+30: return wxT("TB_BUTTONSTRUCTSIZE");
+        case WM_USER+1000+31: return wxT("TB_SETBUTTONSIZE");
+        case WM_USER+1000+32: return wxT("TB_SETBITMAPSIZE");
+        case WM_USER+1000+33: return wxT("TB_AUTOSIZE");
+        case WM_USER+1000+35: return wxT("TB_GETTOOLTIPS");
+        case WM_USER+1000+36: return wxT("TB_SETTOOLTIPS");
+        case WM_USER+1000+37: return wxT("TB_SETPARENT");
+        case WM_USER+1000+39: return wxT("TB_SETROWS");
+        case WM_USER+1000+40: return wxT("TB_GETROWS");
+        case WM_USER+1000+42: return wxT("TB_SETCMDID");
+        case WM_USER+1000+43: return wxT("TB_CHANGEBITMAP");
+        case WM_USER+1000+44: return wxT("TB_GETBITMAP");
+        case WM_USER+1000+45: return wxT("TB_GETBUTTONTEXTA");
+        case WM_USER+1000+75: return wxT("TB_GETBUTTONTEXTW");
+        case WM_USER+1000+46: return wxT("TB_REPLACEBITMAP");
+        case WM_USER+1000+47: return wxT("TB_SETINDENT");
+        case WM_USER+1000+48: return wxT("TB_SETIMAGELIST");
+        case WM_USER+1000+49: return wxT("TB_GETIMAGELIST");
+        case WM_USER+1000+50: return wxT("TB_LOADIMAGES");
+        case WM_USER+1000+51: return wxT("TB_GETRECT");
+        case WM_USER+1000+52: return wxT("TB_SETHOTIMAGELIST");
+        case WM_USER+1000+53: return wxT("TB_GETHOTIMAGELIST");
+        case WM_USER+1000+54: return wxT("TB_SETDISABLEDIMAGELIST");
+        case WM_USER+1000+55: return wxT("TB_GETDISABLEDIMAGELIST");
+        case WM_USER+1000+56: return wxT("TB_SETSTYLE");
+        case WM_USER+1000+57: return wxT("TB_GETSTYLE");
+        case WM_USER+1000+58: return wxT("TB_GETBUTTONSIZE");
+        case WM_USER+1000+59: return wxT("TB_SETBUTTONWIDTH");
+        case WM_USER+1000+60: return wxT("TB_SETMAXTEXTROWS");
+        case WM_USER+1000+61: return wxT("TB_GETTEXTROWS");
+        case WM_USER+1000+41: return wxT("TB_GETBITMAPFLAGS");
     }
     }
-   return NULL;
+
+    static wxString s_szBuf;
+    s_szBuf.Printf(wxT("<unknown message = %d>"), nMessage);
+    return s_szBuf.c_str();
+
 } // end of wxGetMessageName
 
 #endif // __WXDEBUG__
 } // end of wxGetMessageName
 
 #endif // __WXDEBUG__
@@ -5240,25 +4957,21 @@ static void TranslateKbdEventToMouse(
 
 // Find the wxWindow at the current mouse position, returning the mouse
 // position.
 
 // Find the wxWindow at the current mouse position, returning the mouse
 // position.
-wxWindow* wxFindWindowAtPointer(
-  wxPoint&                          WXUNUSED(rPt)
-)
+wxWindow* wxFindWindowAtPointer(wxPoint& WXUNUSED(rPt))
 {
     return wxFindWindowAtPoint(wxGetMousePosition());
 }
 
 {
     return wxFindWindowAtPoint(wxGetMousePosition());
 }
 
-wxWindow* wxFindWindowAtPoint(
-  const wxPoint&                    rPt
-)
+wxWindow* wxFindWindowAtPoint(const wxPoint& rPt)
 {
 {
-    POINTL                          vPt2;
+    POINTL vPt2;
 
     vPt2.x = rPt.x;
     vPt2.y = rPt.y;
 
 
     vPt2.x = rPt.x;
     vPt2.y = rPt.y;
 
-    HWND                            hWndHit = ::WinWindowFromPoint(HWND_DESKTOP, &vPt2, FALSE);
-    wxWindow*                       pWin = wxFindWinFromHandle((WXHWND)hWndHit) ;
-    HWND                            hWnd = hWndHit;
+    HWND      hWndHit = ::WinWindowFromPoint(HWND_DESKTOP, &vPt2, FALSE);
+    wxWindow* pWin = wxFindWinFromHandle((WXHWND)hWndHit) ;
+    HWND      hWnd = hWndHit;
 
     //
     // Try to find a window with a wxWindow associated with it
 
     //
     // Try to find a window with a wxWindow associated with it
@@ -5274,23 +4987,38 @@ wxWindow* wxFindWindowAtPoint(
 // Get the current mouse position.
 wxPoint wxGetMousePosition()
 {
 // Get the current mouse position.
 wxPoint wxGetMousePosition()
 {
-    POINTL                          vPt;
+    POINTL vPt;
 
     ::WinQueryPointerPos(HWND_DESKTOP, &vPt);
     return wxPoint(vPt.x, vPt.y);
 }
 
 
     ::WinQueryPointerPos(HWND_DESKTOP, &vPt);
     return wxPoint(vPt.x, vPt.y);
 }
 
-wxWindowOS2* FindWindowForMouseEvent(
-  wxWindow*                         pWin
-, short*                            pnX
-, short*                            pnY
-)
+wxMouseState wxGetMouseState()
 {
 {
-    HWND                            hWnd = GetHwndOf(pWin);
-    HWND                            hWndUnderMouse;
-    POINTL                          vPoint;
-    BOOL                            rcEnabled = FALSE;
-    BOOL                            rcVisible = FALSE;
+    wxMouseState ms;
+    wxPoint pt = wxGetMousePosition();
+    ms.SetX(pt.x);
+    ms.SetY(pt.y);
+    ms.SetLeftDown(IsKeyDown(VK_BUTTON1));
+    ms.SetMiddleDown(IsKeyDown(VK_BUTTON3));
+    ms.SetRightDown(IsKeyDown(VK_BUTTON2));
+    ms.SetControlDown(IsCtrlDown());
+    ms.SetShiftDown(IsShiftDown());
+    ms.SetAltDown(IsKeyDown(VK_ALT)|IsKeyDown(VK_ALTGRAF));
+    ms.SetMetaDown(IsKeyDown(VK_ALTGRAF));
+    return ms;
+}
+
+
+wxWindowOS2* FindWindowForMouseEvent( wxWindow* pWin,
+                                      short*    WXUNUSED(pnX),
+                                      short*    WXUNUSED(pnY) )
+{
+    HWND   hWnd = GetHwndOf(pWin);
+    HWND   hWndUnderMouse;
+    POINTL vPoint;
+    BOOL   rcEnabled = FALSE;
+    BOOL   rcVisible = FALSE;
 
     ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
     hWndUnderMouse = ::WinWindowFromPoint(HWND_DESKTOP, &vPoint, TRUE);
 
     ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
     hWndUnderMouse = ::WinWindowFromPoint(HWND_DESKTOP, &vPoint, TRUE);
@@ -5300,7 +5028,7 @@ wxWindowOS2* FindWindowForMouseEvent(
 
         if (pWinUnderMouse)
         {
 
         if (pWinUnderMouse)
         {
-            wxWindowList::Node*     pCurrent = pWinUnderMouse->GetChildren().GetFirst();
+            wxWindowList::compatibility_iterator current = pWinUnderMouse->GetChildren().GetFirst();
             wxWindow*               pGrandChild = NULL;
             RECTL                   vRect;
             POINTL                  vPoint2;
             wxWindow*               pGrandChild = NULL;
             RECTL                   vRect;
             POINTL                  vPoint2;
@@ -5309,9 +5037,9 @@ wxWindowOS2* FindWindowForMouseEvent(
             //
             // Find a child window mouse might be under
             //
             //
             // Find a child window mouse might be under
             //
-            while (pCurrent)
+            while (current)
             {
             {
-                wxWindow*                   pChild = pCurrent->GetData();
+                wxWindow*                   pChild = current->GetData();
 
                 vPoint2.x = vPoint.x;
                 vPoint2.y = vPoint.y;
 
                 vPoint2.x = vPoint.x;
                 vPoint2.y = vPoint.y;
@@ -5322,11 +5050,11 @@ wxWindowOS2* FindWindowForMouseEvent(
                     if (pChild->IsTopLevel())
                     {
                         POINTL                  vPoint3;
                     if (pChild->IsTopLevel())
                     {
                         POINTL                  vPoint3;
-                        wxWindowList::Node*     pCurrent2 =pChild->GetChildren().GetFirst();
+                        wxWindowList::compatibility_iterator current2 =pChild->GetChildren().GetFirst();
 
 
-                        while (pCurrent2)
+                        while (current2)
                         {
                         {
-                            wxWindow*           pGrandChild = pCurrent2->GetData();
+                            wxWindow*           pGrandChild = current2->GetData();
 
                             vPoint3.x = vPoint2.x;
                             vPoint3.y = vPoint2.y;
 
                             vPoint3.x = vPoint2.x;
                             vPoint3.y = vPoint2.y;
@@ -5342,7 +5070,7 @@ wxWindowOS2* FindWindowForMouseEvent(
                                 pWinUnderMouse = pGrandChild;
                                 break;
                             }
                                 pWinUnderMouse = pGrandChild;
                                 break;
                             }
-                            pCurrent2 = pCurrent2->GetNext();
+                            current2 = current2->GetNext();
                         }
                         if (pGrandChild)
                             break;
                         }
                         if (pGrandChild)
                             break;
@@ -5354,7 +5082,7 @@ wxWindowOS2* FindWindowForMouseEvent(
                     if (rcVisible && rcEnabled)
                         break;
                 }
                     if (rcVisible && rcEnabled)
                         break;
                 }
-                pCurrent = pCurrent->GetNext();
+                current = current->GetNext();
             }
         }
     }
             }
         }
     }
@@ -5382,4 +5110,3 @@ wxWindowOS2* FindWindowForMouseEvent(
     }
     return pWin;
 } // end of FindWindowForMouseEvent
     }
     return pWin;
 } // end of FindWindowForMouseEvent
-