From 97d74dd29510ecec88b3f8cf9c986536f7512a38 Mon Sep 17 00:00:00 2001
From: David Webster <Dave.Webster@bhmi.com>
Date: Mon, 8 Jul 2002 18:23:33 +0000
Subject: [PATCH] Toolbar fixes and weekly catch-up.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/os2/button.cpp   | 18 ++++++++++++------
 src/os2/frame.cpp    |  2 +-
 src/os2/radiobut.cpp | 23 +++++++++++++++++++++++
 src/os2/toolbar.cpp  | 31 ++++++++++++++++++++++++-------
 src/os2/wx23.def     |  8 +++++---
 5 files changed, 65 insertions(+), 17 deletions(-)

diff --git a/src/os2/button.cpp b/src/os2/button.cpp
index 1a7ab387c0..46892a89fc 100644
--- a/src/os2/button.cpp
+++ b/src/os2/button.cpp
@@ -162,13 +162,19 @@ wxSize wxButton::DoGetBestSize() const
     //
     nHeightButton += nHeightChar/1.5;
 
-    wxSize                          vSize = GetDefaultSize();
+    if (!HasFlag(wxBU_EXACTFIT))
+    {
+        wxSize                      vSize = GetDefaultSize();
 
-    if (nWidthButton > vSize.x)
-        vSize.x = nWidthButton;
-    if (nHeightButton > vSize.y)
-        vSize.y = nHeightButton;
-    return vSize;
+        if (nWidthButton > vSize.x)
+            vSize.x = nWidthButton;
+        if (nHeightButton > vSize.y)
+            vSize.y = nHeightButton;
+        return vSize;
+    }
+    return wxSize( nWidthButton
+                  ,nHeightButton
+                 );
 } // end of wxButton::DoGetBestSize
 
 /* static */
diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp
index e725d21116..056ce7bc74 100644
--- a/src/os2/frame.cpp
+++ b/src/os2/frame.cpp
@@ -1182,7 +1182,7 @@ MRESULT EXPENTRY wxFrameMainWndProc(
                         }
                         else
                         {
-                            pSWP[i].x    = vRectl.xLeft;
+                            pSWP[i].x    = vRectl.xLeft + nWidth;
                             pSWP[i].y    = vRectl.yBottom + nHeight;
                             pSWP[i].cx   = vRectl.xRight - (vRectl.xLeft + nWidth);
                             pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - nHeight;
diff --git a/src/os2/radiobut.cpp b/src/os2/radiobut.cpp
index f30fb7e201..d4cc561bab 100644
--- a/src/os2/radiobut.cpp
+++ b/src/os2/radiobut.cpp
@@ -193,3 +193,26 @@ void wxRadioButton::SetValue(
     ::WinSendMsg((HWND)GetHWND(), BM_SETCHECK, (MPARAM)bValue, (MPARAM)0);
 } // end of wxRadioButton::SetValue
 
+MRESULT wxRadioButton::OS2WindowProc(
+  WXUINT                            uMsg
+, WXWPARAM                          wParam
+, WXLPARAM                          lParam
+)
+{
+    if (uMsg == WM_SETFOCUS)
+    {
+        m_bFocusJustSet = TRUE;
+
+        MRESULT                     mRc = wxControl::OS2WindowProc( uMsg
+                                                                   ,wParam
+                                                                   ,lParam
+                                                                  );
+
+        m_bFocusJustSet = FALSE;
+        return mRc;
+    }
+    return wxControl::OS2WindowProc( uMsg
+                                    ,wParam
+                                    ,lParam
+                                   );
+} // end of wxRadioButton::OS2WindowProc
diff --git a/src/os2/toolbar.cpp b/src/os2/toolbar.cpp
index e9b5b35682..16261a8feb 100644
--- a/src/os2/toolbar.cpp
+++ b/src/os2/toolbar.cpp
@@ -827,22 +827,39 @@ void wxToolBar::OnPaint (
                                                 );
             int                     nX;
             int                     nY;
-            int                     nHeight;
+            int                     nHeight = 0;
+            int                     nWidth = 0;
 
             vDc.SetPen(vDarkGreyPen);
-            if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty())
+            if (HasFlag(wxTB_TEXT))
             {
-                nX = pTool->m_vX;
-                nY = pTool->m_vY - (m_vTextY - 6);
-                nHeight = (m_vTextY - 2) + pTool->GetHeight();
+                if (HasFlag(wxTB_HORIZONTAL))
+                {
+                    nX = pTool->m_vX;
+                    nY = pTool->m_vY - (m_vTextY - 6);
+                    nHeight = (m_vTextY - 2) + pTool->GetHeight();
+                }
+                else
+                {
+                    nX = pTool->m_vX + m_xMargin + 10;
+                    nY = pTool->m_vY + m_vTextY + m_toolSeparation;
+                    nWidth = pTool->GetWidth() > m_vTextX ? pTool->GetWidth() : m_vTextX;
+                }
             }
             else
             {
                 nX = pTool->m_vX;
                 nY = pTool->m_vY;
-                nHeight = pTool->GetHeight() - 2;
+                if (HasFlag(wxTB_HORIZONTAL))
+                    nHeight = pTool->GetHeight() - 2;
+                else
+                {
+                    nX += m_xMargin + 10;
+                    nY +=  m_yMargin + m_toolSeparation;
+                    nWidth = pTool->GetWidth();
+                }
             }
-            vDc.DrawLine(nX, nY, nX, nY + nHeight);
+            vDc.DrawLine(nX, nY, nX + nWidth, nY + nHeight);
         }
     }
     nCount--;
diff --git a/src/os2/wx23.def b/src/os2/wx23.def
index b19b91e620..e52fc7ac46 100644
--- a/src/os2/wx23.def
+++ b/src/os2/wx23.def
@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
 CODE LOADONCALL
 
 EXPORTS
-;From library:  F:\DEV\WX2\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
@@ -1946,7 +1946,7 @@ EXPORTS
       wxEVT_NC_LEFT_DCLICK
       wxEVT_INIT_DIALOG
       wxEVT_COMMAND_SET_FOCUS
-  ;From object file:  F:\DEV\WX2\WXWINDOWS\src\common\extended.c
+  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\extended.c
     ;PUBDEFs (Symbols available from object file):
       ConvertToIeeeExtended
       ConvertFromIeeeExtended
@@ -6150,7 +6150,7 @@ EXPORTS
       Read32__17wxTextInputStreamFv
       ;wxTextInputStream::SkipIfEndOfLine(char)
       SkipIfEndOfLine__17wxTextInputStreamFc
-  ;From object file:  F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
+  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
     ;PUBDEFs (Symbols available from object file):
       unzReadCurrentFile
       unzGetCurrentFileInfo
@@ -13925,6 +13925,8 @@ EXPORTS
       SetValue__13wxRadioButtonFUl
       ;wxRadioButton::GetValue() const
       GetValue__13wxRadioButtonCFv
+      ;wxRadioButton::OS2WindowProc(unsigned int,void*,void*)
+      OS2WindowProc__13wxRadioButtonFUiPvT2
   ;From object file:  ..\os2\region.cpp
     ;PUBDEFs (Symbols available from object file):
       ;wxRegion::Combine(const wxRect&,wxRegionOp)
-- 
2.50.0

