From 57ff8a875bff6f8ba8a6616ed7095b74a835c622 Mon Sep 17 00:00:00 2001
From: David Webster <Dave.Webster@bhmi.com>
Date: Mon, 6 Jan 2003 17:42:48 +0000
Subject: [PATCH] no message

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18601 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/os2/scrolbar.h      | 125 +++++-----
 src/os2/choice.cpp             |  17 ++
 src/os2/makefile.va            |   8 +-
 src/os2/menu.cpp               |   9 +
 src/os2/menuitem.cpp           |   3 +
 src/os2/os2jpeg.def            |   4 +-
 src/os2/ownerdrw.cpp           |  89 ++++++-
 src/os2/scrolbar.cpp           | 407 ++++++++++++++++++---------------
 src/os2/textctrl.cpp           |   6 +-
 src/os2/window.cpp             |   2 +
 src/os2/{wx23.def => wx25.def} |  47 +++-
 11 files changed, 455 insertions(+), 262 deletions(-)
 rename src/os2/{wx23.def => wx25.def} (99%)

diff --git a/include/wx/os2/scrolbar.h b/include/wx/os2/scrolbar.h
index af3eba0674..ea0b911915 100644
--- a/include/wx/os2/scrolbar.h
+++ b/include/wx/os2/scrolbar.h
@@ -15,72 +15,85 @@
 #include "wx/scrolbar.h"
 
 // Scrollbar item
-class WXDLLEXPORT wxScrollBar: public wxScrollBarBase
+class WXDLLEXPORT wxScrollBar : public wxScrollBarBase
 {
-  DECLARE_DYNAMIC_CLASS(wxScrollBar)
-
 public:
-  inline wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
-  ~wxScrollBar();
-
-  inline wxScrollBar(wxWindow *parent, wxWindowID id,
-           const wxPoint& pos = wxDefaultPosition,
-           const wxSize& size = wxDefaultSize,
-           long style = wxSB_HORIZONTAL,
-           const wxValidator& validator = wxDefaultValidator,
-           const wxString& name = wxScrollBarNameStr)
-  {
-      Create(parent, id, pos, size, style, validator, name);
-  }
-  bool Create(wxWindow *parent, wxWindowID id,
-           const wxPoint& pos = wxDefaultPosition,
-           const wxSize& size = wxDefaultSize,
-           long style = wxSB_HORIZONTAL,
-           const wxValidator& validator = wxDefaultValidator,
-           const wxString& name = wxScrollBarNameStr);
-
-  int GetThumbPosition() const ;
-  inline int GetThumbSize() const { return m_pageSize; }
-  inline int GetPageSize() const { return m_viewSize; }
-  inline int GetRange() const { return m_objectSize; }
-
-  virtual void SetThumbPosition(int viewStart);
-  virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
-    bool refresh = TRUE);
-
-#if WXWIN_COMPATIBILITY
-  // Backward compatibility
-  int GetValue() const { return GetThumbPosition(); }
-  void SetValue(int viewStart) { SetThumbPosition(viewStart); }
-  void GetValues(int *viewStart, int *viewLength, int *objectLength,
-          int *pageLength) const ;
-  int GetViewLength() const { return m_viewSize; }
-  int GetObjectLength() const { return m_objectSize; }
+    inline wxScrollBar()
+    {
+        m_nPageSize = 0;
+        m_nViewSize = 0;
+        m_nObjectSize = 0;
+    }
+    inline wxScrollBar( wxWindow*          pParent
+                       ,wxWindowID         vId
+                       ,const wxPoint&     rPos = wxDefaultPosition
+                       ,const wxSize&      rSize = wxDefaultSize
+                       ,long               lStyle = wxSB_HORIZONTAL
+#if wxUSE_VALIDATORS
+                       ,const wxValidator& rValidator = wxDefaultValidator
+#endif
+                       ,const wxString&    rsName = wxScrollBarNameStr
+                      )
+    {
+        Create( pParent
+               ,vId
+               ,rPos
+               ,rSize
+               ,lStyle
+#if wxUSE_VALIDATORS
+               ,rValidator
+#endif
+               ,rsName
+              );
+    }
+    ~wxScrollBar();
 
-  void SetPageSize(int pageLength);
-  void SetObjectLength(int objectLength);
-  void SetViewLength(int viewLength);
+    bool Create( wxWindow*          pParent
+                ,wxWindowID         vId
+                ,const wxPoint&     rPos = wxDefaultPosition
+                ,const wxSize&      rSize = wxDefaultSize
+                ,long               lStyle = wxSB_HORIZONTAL
+#if wxUSE_VALIDATORS
+                ,const wxValidator& rValidator = wxDefaultValidator
 #endif
+                ,const wxString&    rsName = wxScrollBarNameStr
+               );
 
-  void Command(wxCommandEvent& event);
+                   int   GetThumbPosition(void) const ;
+    inline         int   GetThumbSize(void) const { return m_nPageSize; }
+    inline         int   GetPageSize(void) const { return m_nViewSize; }
+    inline         int   GetRange(void) const { return m_nObjectSize; }
 
-  virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
-          WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
-  virtual bool OS2OnScroll(int orientation, WXWORD wParam,
-                           WXWORD pos, WXHWND control);
+           virtual void  SetThumbPosition(int nViewStart);
+           virtual void  SetScrollbar( int  nPosition
+                                      ,int  nThumbSize
+                                      ,int  nRange
+                                      ,int  nPageSize
+                                      ,bool bRefresh = TRUE
+                                     );
 
-#if WXWIN_COMPATIBILITY
-  // Backward compatibility: generate an old-style scroll command
-  void OnScroll(wxScrollEvent& event);
-#endif // WXWIN_COMPATIBILITY
+                   void      Command(wxCommandEvent& rEvent);
+            virtual WXHBRUSH OnCtlColor( WXHDC    hDC
+                                        ,WXHWND   hWnd
+                                        ,WXUINT   uCtlColor
+                                        ,WXUINT   uMessage
+                                        ,WXWPARAM wParam
+                                        ,WXLPARAM lParam
+                                       );
+            virtual bool     OS2OnScroll( int    nOrientation
+                                         ,WXWORD wParam
+                                         ,WXWORD wPos
+                                         ,WXHWND hControl
+                                        );
 
 protected:
-  int m_pageSize;
-  int m_viewSize;
-  int m_objectSize;
+    int                             m_nPageSize;
+    int                             m_nViewSize;
+    int                             m_nObjectSize;
 
-DECLARE_EVENT_TABLE()
-};
+private:
+    DECLARE_DYNAMIC_CLASS(wxScrollBar)
+}; // end of CLASS wxScrollBar
 
 #endif
     // _WX_SCROLBAR_H_
diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp
index 88fff750fb..5ae8def9d9 100644
--- a/src/os2/choice.cpp
+++ b/src/os2/choice.cpp
@@ -185,6 +185,16 @@ void wxChoice::SetString(
 )
 {
     SHORT                           nIndexType = 0;
+    void*                           pData;
+
+    if ( m_clientDataItemsType != wxClientData_None )
+    {
+        pData = DoGetItemClientData(n);
+    }
+    else // no client data
+    {
+        pData = NULL;
+    }
 
     ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, 0);
 
@@ -197,6 +207,13 @@ void wxChoice::SetString(
                  ,(MPARAM)nIndexType
                  ,(MPARAM)rsStr.c_str()
                 );
+
+    if (pData)
+    {
+        DoSetItemClientData( n
+                            ,pData
+                           );
+    }
 } // end of wxChoice::SetString
 
 wxString wxChoice::GetString(
diff --git a/src/os2/makefile.va b/src/os2/makefile.va
index e5001f5cfc..f64adfcf2c 100644
--- a/src/os2/makefile.va
+++ b/src/os2/makefile.va
@@ -1113,15 +1113,15 @@ $(WXDIR)\lib\wx.lib: \
 !else
 
 # Update the dynamic link library
-$(WXDIR)\lib\wx23.dll: $(OBJECTS)
+$(WXDIR)\lib\wx25.dll: $(OBJECTS)
     icc @<<
     /B" $(LINKFLAGS)" /Fe$@
     $(LIBS)
     $(DUMMYOBJ)
     $(OBJECTS)
-    $(WXDIR)\src\os2\wx23.def
+    $(WXDIR)\src\os2\wx25.def
 <<
-    implib $(WXDIR)\lib\wx23.lib $(WXDIR)\src\os2\wx23.def
+    implib $(WXDIR)\lib\wx25.lib $(WXDIR)\src\os2\wx25.def
 
 !endif
 
@@ -1200,7 +1200,7 @@ clean:  $(PERIPH_CLEAN_TARGET) clean_png clean_zlib clean_jpeg clean_tiff
         rd      ..\os2\$D
         del      $(LIBTARGET)
 !if "$(WXMAKINGDLL)" == "1"
-        erase /N ..\..\lib\wx23.lib
+        erase /N ..\..\lib\wx25.lib
 !endif
         erase /N $(COMMDIR)\y_tab.c
         erase /N $(COMMDIR)\lex_yy.c
diff --git a/src/os2/menu.cpp b/src/os2/menu.cpp
index 8ca65be64b..8007899907 100644
--- a/src/os2/menu.cpp
+++ b/src/os2/menu.cpp
@@ -750,6 +750,15 @@ wxMenuBar::wxMenuBar(
 
 wxMenuBar::~wxMenuBar()
 {
+    //
+    // We should free PM's resources only if PM doesn't do it for us
+    // which happens if we're attached to a frame
+    //
+    if (m_hMenu && !IsAttached())
+    {
+        ::WinDestroyWindow((HMENU)m_hMenu);
+        m_hMenu = (WXHMENU)NULL;
+    }
 } // end of wxMenuBar::~wxMenuBar
 
 // ---------------------------------------------------------------------------
diff --git a/src/os2/menuitem.cpp b/src/os2/menuitem.cpp
index ca9fc82f00..91c6e9d975 100644
--- a/src/os2/menuitem.cpp
+++ b/src/os2/menuitem.cpp
@@ -423,6 +423,9 @@ void wxMenuItem::SetText(
 
     wxMenuItemBase::SetText(sText);
     OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText));
+#if  wxUSE_OWNER_DRAWN
+    SetAccelString(rText.AfterFirst(_T('\t')));
+#endif // wxUSE_OWNER_DRAWN
 
     HWND                            hMenu = GetHmenuOf(m_parentMenu);
 
diff --git a/src/os2/os2jpeg.def b/src/os2/os2jpeg.def
index 6a6f7aa7cc..b4f69492fb 100644
--- a/src/os2/os2jpeg.def
+++ b/src/os2/os2jpeg.def
@@ -219,7 +219,7 @@ EXPORTS
   ;From object file:  ..\jpeg\jdinput.c
     ;PUBDEFs (Symbols available from object file):
       reset_input_controller
-      start_input_pass2
+      start_input_pass
       jinit_input_controller
       finish_input_pass
       consume_markers
@@ -261,8 +261,8 @@ EXPORTS
   ;From object file:  ..\jpeg\jdcoefct.c
     ;PUBDEFs (Symbols available from object file):
       decompress_data
-      start_input_pass
       decompress_smooth_data
+      start_input_pass2
       decompress_onepass
       dummy_consume_data
       consume_data
diff --git a/src/os2/ownerdrw.cpp b/src/os2/ownerdrw.cpp
index 2cfddaec1b..c352f843de 100644
--- a/src/os2/ownerdrw.cpp
+++ b/src/os2/ownerdrw.cpp
@@ -71,17 +71,100 @@ bool wxOwnerDrawn::OnMeasureItem(
 {
     wxMemoryDC                      vDC;
 
-    vDC.SetFont(GetFont());
 
     wxString                        sStr = wxStripMenuCodes(m_strName);
 
+    //
+    // If we have a valid accel string, then pad out
+    // the menu string so the menu and accel string are not
+    // placed ontop of eachother.
+    if (!m_strAccel.empty() )
+    {
+        sStr.Pad(sStr.Length()%8);
+        sStr += m_strAccel;
+    }
+    vDC.SetFont(GetFont());
     vDC.GetTextExtent( sStr
                       ,(long *)pWidth
                       ,(long *)pHeight
                      );
+    if (!m_strAccel.IsEmpty())
+    {
+        //
+        // Measure the accelerator string, and add it's width to
+        // the total item width, plus 16 (Accelerators are right justified,
+        // with the right edge of the text rectangle 16 pixels left of
+        // the right edge of the menu)
+        //
+        int                         nAccelWidth;
+        int                         nAccelHeight;
+
+        vDC.GetTextExtent( m_strAccel
+                          ,&nAccelWidth
+                          ,&nAccelHeight
+                         );
+        *pWidth += nAccelWidth;
+    }
+
+    //
+    // Add space at the end of the menu for the submenu expansion arrow
+    // this will also allow offsetting the accel string from the right edge
+    //
+    *pWidth += GetDefaultMarginWidth() * 1.5;
+
+    //
+    // JACS: items still look too tightly packed, so adding 5 pixels.
+    //
+    (*pHeight) += 5;
+
+    //
+    // Ray Gilbert's changes - Corrects the problem of a BMP
+    // being placed next to text in a menu item, and the BMP does
+    // not match the size expected by the system.  This will
+    // resize the space so the BMP will fit.  Without this, BMPs
+    // must be no larger or smaller than 16x16.
+    //
+    if (m_bmpChecked.Ok())
+    {
+        //
+        // Is BMP height larger then text height?
+        //
+        size_t                      nAdjustedHeight = m_bmpChecked.GetHeight() +
+                                                      wxSystemSettings::GetMetric(wxSYS_EDGE_Y);
+        if (*pHeight < nAdjustedHeight)
+            *pHeight = nAdjustedHeight;
+
+        //
+        // Does BMP encroach on default check menu position?
+        //
+        size_t                      nAdjustedWidth = m_bmpChecked.GetWidth() +
+                                                     (wxSystemSettings::GetMetric(wxSYS_EDGE_X) * 2);
+
+        //
+        // Do we need to widen margin to fit BMP?
+        //
+        if ((size_t)GetMarginWidth() < nAdjustedWidth)
+            SetMarginWidth(nAdjustedWidth);
 
-    (*pHeight) = (*pHeight) + 2;
-    m_nHeight = *pHeight;        // remember height for use in OnDrawItem
+        //
+        // Add the size of the bitmap to our total size...
+        //
+        *pWidth += GetMarginWidth();
+    }
+
+    //
+    // Add the size of the bitmap to our total size - even if we don't have
+    // a bitmap we leave room for one...
+    //
+    *pWidth += GetMarginWidth();
+
+    //
+    // Make sure that this item is at least as
+    // tall as the user's system settings specify
+    //
+    if (*pHeight < m_nMinHeight)
+        *pHeight = m_nMinHeight;
+    m_nHeight = *pHeight;                // remember height for use in OnDrawItem
     return TRUE;
 } // end of wxOwnerDrawn::OnMeasureItem
 
diff --git a/src/os2/scrolbar.cpp b/src/os2/scrolbar.cpp
index 4b3662cb84..a1f56be9c7 100644
--- a/src/os2/scrolbar.cpp
+++ b/src/os2/scrolbar.cpp
@@ -22,250 +22,291 @@
 
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
 
-BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
-#if WXWIN_COMPATIBILITY
-  EVT_SCROLL(wxScrollBar::OnScroll)
-#endif
-END_EVENT_TABLE()
-
-
 // Scrollbar
-bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
-           const wxPoint& pos,
-           const wxSize& size, long style,
-           const wxValidator& validator,
-           const wxString& name)
+bool wxScrollBar::Create (
+  wxWindow*                         pParent
+, wxWindowID                        vId
+, const wxPoint&                    rPos
+, const wxSize&                     rSize
+, long                              lStyle
+#if wxUSE_VALIDATORS
+, const wxValidator&                rValidator
+#endif
+, const wxString&                   rsName
+)
 {
+    int                             nX = rPos.x;
+    int                             nY = rPos.y;
+    int                             nWidth = rSize.x;
+    int                             nHeight = rSize.y;
+
     if (!parent)
         return FALSE;
-    parent->AddChild(this);
-    SetName(name);
+    pParent->AddChild(this);
+    SetName(rsName);
 #if wxUSE_VALIDATORS
-    SetValidator(validator);
+    SetValidator(rValidator);
 #endif
+    SetBackgroundColour(pParent->GetBackgroundColour()) ;
+    SetForegroundColour(pParent->GetForegroundColour()) ;
 
-    SetBackgroundColour(parent->GetBackgroundColour()) ;
-    SetForegroundColour(parent->GetForegroundColour()) ;
-    m_windowStyle = style;
-
-    if ( id == -1 )
+    if (vId == -1L)
         m_windowId = (int)NewControlId();
     else
-        m_windowId = id;
+        m_windowId = vId;
 
-    int x = pos.x;
-    int y = pos.y;
-    int width = size.x;
-    int height = size.y;
-
-    if (width == -1)
+    if (nWidth == -1)
     {
-        if (style & wxHORIZONTAL)
-            width = 140;
+        if (lStyle & wxHORIZONTAL)
+            nWidth = 140;
         else
-            width = 14;
+            nWidth = 14;
     }
-    if (height == -1)
+    if (nHeight == -1)
     {
-        if (style & wxVERTICAL)
-            height = 140;
+        if (lStyle & wxVERTICAL)
+            nHeight = 140;
         else
-            height = 14;
+            nHeight = 14;
     }
 
-    // TODO create scrollbar
-
-    m_pageSize = 1;
-    m_viewSize = 1;
-    m_objectSize = 1;
-
-    SetFont(parent->GetFont());
-
-    m_hWnd = 0; // TODO: (WXHWND)scroll_bar;
-
-    HWND scroll_bar = 0; // temporary
-
+    DWORD                           dwStyle = WS_VISIBLE;
+
+    if (GetWindowStyleFlag() & wxCLIP_SIBLINGS)
+        dwStyle |= WS_CLIPSIBLINGS;
+
+    DWORD                           dwDirection = (lStyle & wxHORIZONTAL) ? SBS_HORZ: SBS_VERT;
+
+    HWND                            hScrollBar = ::WinCreateWindow( (HWND)GetHwndOf(pParent)
+                                                                   ,WC_SCROLLBAR
+                                                                   ,(PSZ)NULL
+                                                                   ,dwDirection | dwStyle
+                                                                   ,0, 0, 0, 0
+                                                                   ,(HWND)GetHwndOf(pParent)
+                                                                   ,HWND_TOP
+                                                                   ,(HMENU)m_windowId
+                                                                   ,NULL
+                                                                   ,NULL
+                                                                  );
+
+    m_nPageSize = 1;
+    m_nViewSize = 1;
+    m_nObjectSize = 1;
+    ::WinSendMsg( hScrollBar
+                 ,SBM_SETSCROLLBAR
+                 ,(MPARAM)0
+                 ,MPFROM2SHORT(0,1)
+                );
+    ::WinShowWindow( hScrollBar
+                    ,TRUE
+                   );
+    SetFont(*wxSMALL_FONT);
+
+    m_hWnd = hScrollBar;
+
+    //
     // Subclass again for purposes of dialog editing mode
-    SubclassWin((WXHWND) scroll_bar);
-
-    SetSize(x, y, width, height);
-
+    //
+    SubclassWin((WXHWND)hScrollBar);
+    SetSize( nX
+            ,nY
+            ,nWidth
+            ,nHeight
+           );
     return TRUE;
-}
+} // end of wxScrollBar::Create
 
 wxScrollBar::~wxScrollBar()
 {
 }
 
-bool wxScrollBar::OS2OnScroll(int WXUNUSED(orientation), WXWORD wParam,
-                              WXWORD pos, WXHWND control)
+bool wxScrollBar::OS2OnScroll (
+  int                               nOrientation
+, WXWORD                            wParam
+, WXWORD                            wPos
+, WXHWND                            hControl
+)
 {
-    // TODO:
-/*
-    int position = ::GetScrollPos((HWND) control, SB_CTL);
-    int minPos, maxPos;
-    ::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
+    int                             nPosition;
+    int                             nMaxPos;
+    int                             nTrackPos = wPos;
+    int                             nMinPos;
+    int                             nScrollInc;
+    wxEventType                     vScrollEvent = wxEVT_NULL;
+
+    MRESULT                         vRange;
+
+    //
+    // When we're dragging the scrollbar we can't use pos parameter because it
+    // is limited to 16 bits
+    //
+    if (wParam == SB_SLIDERPOSITION || wParam == SB_SLIDERTRACK)
+    {
+        SBCDATA                     vScrollInfo;
+
+        vScrollInfo.sHilite = SB_SLIDERTRACK;
 
-#if defined(__WIN95__)
+        ::WinSendMsg((HWND)GetHwnd(), WM_QUERYWINDOWPARAMS, (PVOID)&vScrollInfo, NULL);
+
+        nTrackPos = vScrollInfo.posThumb;
+        nPosition = vScrollInfo.posFirst;
+        nMaxPos   = vScrollInfo.posLast;
+    }
+    else
+    {
+        nPosition = (int)(MRESULT)::WinSendMsg((HWND)GetHwnd(), SBM_QUERYPOS, (MPARAM)NULL, (MPARAM)NULL);
+        vRange = ::WinSendMsg((HWND)GetHwnd(), SBM_QUERYRANGE, (MPARAM)NULL, (MPARAM)NULL);
+        nMinPos = SHORT1FROMMR(vRange);
+        nMaxPos = SHORT2FROMMR(vRange);
+    }
+    //
     // A page size greater than one has the effect of reducing the effective
     // range, therefore the range has already been boosted artificially - so
     // reduce it again.
-    if ( m_pageSize > 1 )
-        maxPos -= (m_pageSize - 1);
-#endif // __WIN95__
-
-    wxEventType scrollEvent = wxEVT_NULL;
-
-    int nScrollInc;
-    switch ( wParam )
+    //
+    if (m_nPageSize > 1)
+        nMaxPos -= (m_nPageSize - 1);
+    switch (wParam)
     {
-        case SB_TOP:
-            nScrollInc = maxPos - position;
-            scrollEvent = wxEVT_SCROLL_TOP;
-            break;
-
-        case SB_BOTTOM:
-            nScrollInc = - position;
-            scrollEvent = wxEVT_SCROLL_BOTTOM;
-            break;
-
         case SB_LINEUP:
-            nScrollInc = -1;
-            scrollEvent = wxEVT_SCROLL_LINEUP;
+            nScrollInc   = -1;
+            vScrollEvent = wxEVT_SCROLL_LINEUP;
             break;
 
         case SB_LINEDOWN:
-            nScrollInc = 1;
-            scrollEvent = wxEVT_SCROLL_LINEDOWN;
+            nScrollInc   = 1;
+            vScrollEvent = wxEVT_SCROLL_LINEDOWN;
             break;
 
         case SB_PAGEUP:
-            nScrollInc = -GetPageSize();
-            scrollEvent = wxEVT_SCROLL_PAGEUP;
+            nScrollInc   = -GetPageSize();
+            vScrollEvent = wxEVT_SCROLL_PAGEUP;
             break;
 
         case SB_PAGEDOWN:
-            nScrollInc = GetPageSize();
-            scrollEvent = wxEVT_SCROLL_PAGEDOWN;
+            nScrollInc   = GetPageSize();
+            vScrollEvent = wxEVT_SCROLL_PAGEDOWN;
+            break;
+
+        case SB_SLIDERTRACK:
+            nScrollInc   = nTrackPos - nPosition;
+            vScrollEvent = wxEVT_SCROLL_THUMBTRACK;
             break;
 
-        case SB_THUMBTRACK:
-        case SB_THUMBPOSITION:
-            nScrollInc = pos - position;
-            scrollEvent = wxEVT_SCROLL_THUMBTRACK;
+        case SB_ENDSCROLL:
+            nScrollInc   = 0;
+            vScrollEvent = wxEVT_SCROLL_ENDSCROLL;
             break;
 
         default:
             nScrollInc = 0;
     }
+    if (nScrollInc)
+    {
+        nPosition += nScrollInc;
 
-    if ( nScrollInc == 0 )
+        if (nPosition < 0)
+            nPosition = 0;
+        if (nPosition > nMaxPos)
+            nPosition = nMaxPos;
+        SetThumbPosition(nPosition);
+    }
+    else if ( vScrollEvent != wxEVT_SCROLL_THUMBRELEASE &&
+              vScrollEvent != wxEVT_SCROLL_ENDSCROLL
+            )
     {
-        // no event to process, so don't process it
+        //
+        // Don't process the event if there is no displacement,
+        // unless this is a thumb release or end scroll event.
+        //
         return FALSE;
     }
 
-    int new_pos = position + nScrollInc;
+    wxScrollEvent                   vEvent( vScrollEvent
+                                           ,m_windowId
+                                          );
 
-    if (new_pos < 0)
-        new_pos = 0;
-    if (new_pos > maxPos)
-        new_pos = maxPos;
+    vEvent.SetPosition(nPosition);
+    vEvent.SetEventObject(this);
+    return GetEventHandler()->ProcessEvent(vEvent);
+} // end of wxScrollBar::OS2OnScroll
 
-    SetThumbPosition(new_pos);
-    wxScrollEvent event(scrollEvent, m_windowId);
-    event.SetPosition(new_pos);
-    event.SetEventObject( this );
-
-    return GetEventHandler()->ProcessEvent(event);
-*/
-    return FALSE;
-}
-
-void wxScrollBar::SetThumbPosition(int viewStart)
-{
-    // TODO
-}
-
-int wxScrollBar::GetThumbPosition() const
-{
-    // TODO
-    return 0;
-}
-
-void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize,
-    bool refresh)
-{
-    m_viewSize = pageSize;
-    m_pageSize = thumbSize;
-    m_objectSize = range;
-
-    // TODO
-}
-
-#if WXWIN_COMPATIBILITY
-void wxScrollBar::SetPageSize(int pageLength)
-{
-    m_pageSize = pageLength;
-
-    // TODO:
-}
-
-void wxScrollBar::SetObjectLength(int objectLength)
+void wxScrollBar::SetThumbPosition (
+  int                               nViewStart
+)
 {
-    m_objectSize = objectLength;
+    SBCDATA                        vInfo;
 
-    // The range (number of scroll steps) is the
-    // object length minus the view size.
-    int range = wxMax((objectLength - m_viewSize), 0) ;
+    memset(&vInfo, '\0', sizeof(SBCDATA));
+    vInfo.cb       = sizeof(SBCDATA);
+    vInfo.posThumb = nViewStart;
 
-    // TODO:
-}
+    ::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL);
+    ::WinSendMsg((HWND)GetHwnd(), SBM_SETPOS, (MPARAM)nViewStart, (MPARAM)NULL);
+} // end of wxScrollBar::SetThumbPosition
 
-void wxScrollBar::SetViewLength(int viewLength)
+int wxScrollBar::GetThumbPosition() const
 {
-    m_viewSize = viewLength;
-}
-
-void wxScrollBar::GetValues(int *viewStart, int *viewLength, int *objectLength,
-           int *pageLength) const
+    return((int)(MRESULT)::WinSendMsg((HWND)GetHwnd(), SBM_QUERYPOS, (MPARAM)NULL, (MPARAM)NULL));
+} // end of wxScrollBar::GetThumbPosition
+
+void wxScrollBar::SetScrollbar (
+  int                               nPosition
+, int                               nThumbSize
+, int                               nRange
+, int                               nPageSize
+, bool                              bRefresh
+)
 {
-// TODO:
-/*
-    *viewStart = ::GetScrollPos((HWND)m_hWnd, SB_CTL);
-    *viewLength = m_viewSize;
-    *objectLength = m_objectSize;
-    *pageLength = m_pageSize;
-*/
-}
-#endif
-
-WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
-            WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+    SBCDATA                         vInfo;
+    //
+    // The lRange (number of scroll steps) is the
+    // object length minus the page size.
+    //
+    int                             nRange1 = wxMax((m_nObjectSize - m_nPageSize), 0);
+
+    m_nViewSize   = nPageSize;
+    m_nPageSize   = nThumbSize;
+    m_nObjectSize = nRange;
+
+
+    //
+    // Try to adjust the lRange to cope with page size > 1
+    // (see comment for SetPageLength)
+    //
+    if (m_nPageSize > 1 )
+    {
+        nRange1 += (m_nPageSize - 1);
+    }
+    vInfo.cb = sizeof(SBCDATA);
+    vInfo.cVisible = m_nPageSize;
+    vInfo.posFirst = 0;
+    vInfo.posLast  = nRange1;
+    vInfo.posThumb = nPosition;
+
+    ::WinSendMsg((HWND)GetHwnd(), WM_SETWINDOWPARAMS, (MPARAM)&vInfo, (MPARAM)NULL);
+} // end of wxScrollBar::SetScrollbar
+
+WXHBRUSH wxScrollBar::OnCtlColor (
+  WXHDC                             hDC
+, WXHWND                            hWnd
+, WXUINT                            uCtlColor
+, WXUINT                            uMessage
+, WXWPARAM                          wParam
+, WXLPARAM                          lParam
+)
 {
-  return 0;
-}
+    //
+    // Does nothing under OS/2
+    //
+    return 0;
+} // end of wxScrollBar::OnCtlColor
 
-void wxScrollBar::Command(wxCommandEvent& event)
+void wxScrollBar::Command (
+  wxCommandEvent&                   rEvent
+)
 {
-    SetThumbPosition(event.m_commandInt);
-    ProcessCommand(event);
-}
+    SetThumbPosition(rEvent.m_commandInt);
+    ProcessCommand(rEvent);
+} // end of wxScrollBar::Command
 
-#if WXWIN_COMPATIBILITY
-// Backward compatibility
-void wxScrollBar::OnScroll(wxScrollEvent& event)
-{
-    // TODO:
-/*
-    wxEventType oldEvent = event.GetEventType();
-    event.SetEventType( wxEVT_COMMAND_SCROLLBAR_UPDATED );
-    if ( !GetEventHandler()->ProcessEvent(event) )
-    {
-        event.SetEventType( oldEvent );
-        if (!GetParent()->GetEventHandler()->ProcessEvent(event))
-            event.Skip();
-    }
-*/
-}
-#endif
diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp
index 1e4d42ab48..3b2b97719a 100644
--- a/src/os2/textctrl.cpp
+++ b/src/os2/textctrl.cpp
@@ -1171,9 +1171,11 @@ void wxTextCtrl::AdjustSpaceLimit()
 bool wxTextCtrl::AcceptsFocus() const
 {
     //
-    // We don't want focus if we can't be edited
+    // We don't want focus if we can't be edited unless we're a multiline
+    // control because then it might be still nice to get focus from keyboard
+    // to be able to scroll it without mouse
     //
-    return IsEditable() && wxControl::AcceptsFocus();
+    return (IsEditable() || IsMultiLine()) && wxControl::AcceptsFocus();
 } // end of wxTextCtrl::Command
 
 wxSize wxTextCtrl::DoGetBestSize() const
diff --git a/src/os2/window.cpp b/src/os2/window.cpp
index 4ab8890da9..96931c33eb 100644
--- a/src/os2/window.cpp
+++ b/src/os2/window.cpp
@@ -2234,6 +2234,8 @@ static void wxYieldForCommandsOnly()
     {
         wxTheApp->DoMessage((WXMSG*)&vMsg);
     }
+    if (vMsg.msg == WM_QUIT)
+        ::WinPostMsg(NULL, WM_QUIT, 0, 0);
 }
 #endif // wxUSE_MENUS_NATIVE
 
diff --git a/src/os2/wx23.def b/src/os2/wx25.def
similarity index 99%
rename from src/os2/wx23.def
rename to src/os2/wx25.def
index fa63bc9b47..489be36794 100644
--- a/src/os2/wx23.def
+++ b/src/os2/wx25.def
@@ -1,10 +1,10 @@
-LIBRARY WX23 INITINSTANCE TERMINSTANCE
+LIBRARY WX25 INITINSTANCE TERMINSTANCE
 PROTMODE
 DATA MULTIPLE NONSHARED READWRITE LOADONCALL
 CODE LOADONCALL
 
 EXPORTS
-;From library:  H:\Dev\Wx24\WxWindows\lib\wx.lib
+;From library:  H:\DEV\WX2\WXWINDOWS\LIB\wx.lib
   ;From object file:  dummy.cpp
     ;PUBDEFs (Symbols available from object file):
       wxDummyChar
@@ -1969,7 +1969,7 @@ EXPORTS
       wxEVT_NC_LEFT_DCLICK
       wxEVT_INIT_DIALOG
       wxEVT_COMMAND_SET_FOCUS
-  ;From object file:  H:\DEV\WX24\WXWINDOWS\src\common\extended.c
+  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\extended.c
     ;PUBDEFs (Symbols available from object file):
       ConvertToIeeeExtended
       ConvertFromIeeeExtended
@@ -2364,6 +2364,8 @@ EXPORTS
       ms_root__16wxLocalFSHandler
       ;wxFileSystemHandler::GetMimeTypeFromExt(const wxString&)
       GetMimeTypeFromExt__19wxFileSystemHandlerFRC8wxString
+      ;wxFileSystem::URLToFileName(const wxString&)
+      URLToFileName__12wxFileSystemFRC8wxString
       ;wxFSFile::sm_classwxFSFile
       sm_classwxFSFile__8wxFSFile
       ;wxFileSystemModule::sm_classwxFileSystemModule
@@ -2376,6 +2378,8 @@ EXPORTS
       CleanUpHandlers__12wxFileSystemFv
       ;wxFileSystemHandler::GetLeftLocation(const wxString&) const
       GetLeftLocation__19wxFileSystemHandlerCFRC8wxString
+      ;wxFileSystem::FileNameToURL(const wxFileName&)
+      FileNameToURL__12wxFileSystemFRC10wxFileName
       ;wxConstructorForwxFileSystem()
       wxConstructorForwxFileSystem__Fv
       ;wxFileSystemHandler::GetProtocol(const wxString&) const
@@ -2443,6 +2447,8 @@ EXPORTS
       GetFamilyString__10wxFontBaseCFv
       ;wxFontBase::SetDefaultEncoding(wxFontEncoding)
       SetDefaultEncoding__10wxFontBaseF14wxFontEncoding
+      ;wxFontBase::New(int,wxFontFamily,int,const wxString&,wxFontEncoding)
+      New__10wxFontBaseFi12wxFontFamilyT1RC8wxString14wxFontEncoding
       ;wxFontBase::IsFixedWidth() const
       IsFixedWidth__10wxFontBaseCFv
       ;wxFontBase::New(int,int,int,int,unsigned long,const wxString&,wxFontEncoding)
@@ -6278,7 +6284,7 @@ EXPORTS
       Read32__17wxTextInputStreamFv
       ;wxTextInputStream::SkipIfEndOfLine(char)
       SkipIfEndOfLine__17wxTextInputStreamFc
-  ;From object file:  H:\DEV\WX24\WXWINDOWS\src\common\unzip.c
+  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
     ;PUBDEFs (Symbols available from object file):
       unzReadCurrentFile
       unzGetCurrentFileInfo
@@ -7246,6 +7252,8 @@ EXPORTS
       wxMB2WC__FPwPCcUi
       ;wxSnprintf_(char*,unsigned int,const char*,...)
       wxSnprintf___FPcUiPCce
+      ;wxStrdupW(const wchar_t*)
+      wxStrdupW__FPCw
       ;wxWC2MB(char*,const wchar_t*,unsigned int)
       wxWC2MB__FPcPCwUi
       ;wxOKlibc()
@@ -8128,6 +8136,12 @@ EXPORTS
       LookupAttr__6wxGridCFiT1PP14wxGridCellAttr
       ;wxGridCellAttrProvider::InitData()
       InitData__22wxGridCellAttrProviderFv
+      ;wxGridCellNumberEditor::GetValue() const
+      GetValue__22wxGridCellNumberEditorCFv
+      ;wxGridCellChoiceEditor::GetValue() const
+      GetValue__22wxGridCellChoiceEditorCFv
+      ;wxGridCellBoolEditor::GetValue() const
+      GetValue__20wxGridCellBoolEditorCFv
       ;wxGrid::GetSelectionMode() const
       GetSelectionMode__6wxGridCFv
       ;wxGridCellAttr::GetRenderer(wxGrid*,int,int) const
@@ -8544,6 +8558,8 @@ EXPORTS
       IsSelection__6wxGridFv
       ;wxGrid::IsCellEditControlEnabled() const
       IsCellEditControlEnabled__6wxGridCFv
+      ;wxGridCellTextEditor::GetValue() const
+      GetValue__20wxGridCellTextEditorCFv
       ;wxGrid::GetSelectionBlockBottomRight() const
       GetSelectionBlockBottomRight__6wxGridCFv
       ;wxGridCornerLabelWindow::GetEventTable() const
@@ -9917,6 +9933,8 @@ EXPORTS
       GetEventTable__23wxGenericMDIParentFrameCFv
       ;wxGenericMDIParentFrame::GetClientWindow() const
       GetClientWindow__23wxGenericMDIParentFrameCFv
+      ;wxMDIParentFrame::GetActiveChild() const
+      GetActiveChild__16wxMDIParentFrameCFv
       ;wxGenericMDIChildFrame::Create(wxGenericMDIParentFrame*,int,const wxString&,const wxPoint&,const wxSize&,long,const wxString&)
       Create__22wxGenericMDIChildFrameFP23wxGenericMDIParentFrameiRC8wxStringRC7wxPointRC6wxSizelT3
       ;wxGenericMDIChildFrame::OnMenuHighlight(wxMenuEvent&)
@@ -10131,6 +10149,8 @@ EXPORTS
       sm_eventTable__16wxProgressDialog
       ;wxProgressDialog::sm_eventTableEntries
       sm_eventTableEntries__16wxProgressDialog
+      ;wxProgressDialog::Show(unsigned long)
+      Show__16wxProgressDialogFUl
       ;wxProgressDialog::OnCancel(wxCommandEvent&)
       OnCancel__16wxProgressDialogFR14wxCommandEvent
       ;wxProgressDialog::ReenableOtherWindows()
@@ -10831,6 +10851,8 @@ EXPORTS
       SetItemImage__17wxGenericTreeCtrlFRC12wxTreeItemIdi14wxTreeItemIcon
       ;wxGenericTreeCtrl::SelectItem(const wxTreeItemId&,unsigned long,unsigned long)
       SelectItem__17wxGenericTreeCtrlFRC12wxTreeItemIdUlT2
+      ;wxGenericTreeCtrl::ResetTextControl()
+      ResetTextControl__17wxGenericTreeCtrlFv
       ;wxGenericTreeCtrl::GetButtonsImageList() const
       GetButtonsImageList__17wxGenericTreeCtrlCFv
       ;wxTreeTextCtrl::AcceptChanges()
@@ -10879,6 +10901,8 @@ EXPORTS
       SetItemBackgroundColour__17wxGenericTreeCtrlFRC12wxTreeItemIdRC8wxColour
       ;wxTreeTextCtrl::GetEventTable() const
       GetEventTable__14wxTreeTextCtrlCFv
+      ;wxGenericTreeCtrl::GetEditControl() const
+      GetEditControl__17wxGenericTreeCtrlCFv
       ;wxTreeTextCtrl::Finish()
       Finish__14wxTreeTextCtrlFv
       ;wxGenericTreeCtrl::FillArray(wxGenericTreeItem*,wxArrayTreeItemIds&) const
@@ -10930,6 +10954,8 @@ EXPORTS
       __dt__20wxHtmlHelpControllerFv
       ;wxHtmlHelpController::OnCloseFrame(wxCloseEvent&)
       OnCloseFrame__20wxHtmlHelpControllerFR12wxCloseEvent
+      ;wxHtmlHelpController::AddBook(const wxFileName&,unsigned long)
+      AddBook__20wxHtmlHelpControllerFRC10wxFileNameUl
       ;wxHtmlHelpController::wxHtmlHelpController(int)
       __ct__20wxHtmlHelpControllerFi
       ;wxHtmlHelpController::DisplayContents()
@@ -14155,8 +14181,6 @@ EXPORTS
       wxConstructorForwxScrollBar__Fv
       ;wxScrollBar::~wxScrollBar()
       __dt__11wxScrollBarFv
-      ;wxScrollBar::GetEventTable() const
-      GetEventTable__11wxScrollBarCFv
       ;wxScrollBar::Create(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxValidator&,const wxString&)
       Create__11wxScrollBarFP8wxWindowiRC7wxPointRC6wxSizelRC11wxValidatorRC8wxString
       ;wxScrollBar::SetScrollbar(int,int,int,int,unsigned long)
@@ -14164,14 +14188,10 @@ EXPORTS
       ;wxScrollBar::GetThumbPosition() const
       GetThumbPosition__11wxScrollBarCFv
       __vft11wxScrollBar8wxObject
-      ;wxScrollBar::sm_eventTableEntries
-      sm_eventTableEntries__11wxScrollBar
       ;wxScrollBar::sm_classwxScrollBar
       sm_classwxScrollBar__11wxScrollBar
       ;wxScrollBar::Command(wxCommandEvent&)
       Command__11wxScrollBarFR14wxCommandEvent
-      ;wxScrollBar::sm_eventTable
-      sm_eventTable__11wxScrollBar
   ;From object file:  ..\os2\settings.cpp
     ;PUBDEFs (Symbols available from object file):
       ;wxSystemSettingsModule::sm_classwxSystemSettingsModule
@@ -14572,16 +14592,19 @@ EXPORTS
       Remove__10wxTextCtrlFlT1
       ;wxTextCtrl::SetSelection(long,long)
       SetSelection__10wxTextCtrlFlT1
-      ;wxTextCtrl::Copy()
-      Copy__10wxTextCtrlFv
+      ;wxTextCtrl::~wxTextCtrl()
+      __dt__10wxTextCtrlFv
       ;wxTextCtrl::SetStyle(long,long,const wxTextAttr&)
       SetStyle__10wxTextCtrlFlT1RC10wxTextAttr
+      ;wxTextCtrl::Copy()
+      Copy__10wxTextCtrlFv
       ;wxTextCtrl::CanRedo() const
       CanRedo__10wxTextCtrlCFv
       ;wxTextCtrl::OS2GetStyle(long,unsigned long*) const
       OS2GetStyle__10wxTextCtrlCFlPUl
       ;wxTextCtrl::sm_classwxTextCtrl
       sm_classwxTextCtrl__10wxTextCtrl
+      __vft10wxTextCtrl8wxObject
       ;wxTextCtrl::ShowPosition(long)
       ShowPosition__10wxTextCtrlFl
       ;wxTextCtrl::SetWindowStyleFlag(long)
-- 
2.50.0

