]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/button.cpp
ignore clicks on a toolbar but outside any button
[wxWidgets.git] / src / os2 / button.cpp
index f77b45338a8629c5d0e1b2eb77fb3891ee2445b8..133a6f6cd57ecfa6657873d00742e8547c1bb654 100644 (file)
@@ -19,6 +19,7 @@
     #include "wx/bmpbuttn.h"
     #include "wx/settings.h"
     #include "wx/dcscreen.h"
+    #include "wx/scrolwin.h"
 #endif
 
 #include "wx/os2/private.h"
@@ -70,14 +71,6 @@ bool wxButton::Create(
     //
     if (m_windowStyle & wxCLIP_SIBLINGS )
         lStyle |= WS_CLIPSIBLINGS;
-    //
-    // If the parent is a scrolled window the controls must
-    // have this style or they will overlap the scrollbars
-    //
-    if (pParent)
-        if (pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) ||
-            pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)))
-            lStyle |= WS_CLIPSIBLINGS;
 
     m_hWnd = (WXHWND)::WinCreateWindow( GetHwndOf(pParent)   // Parent handle
                                        ,WC_BUTTON            // A Button class window
@@ -99,12 +92,20 @@ bool wxButton::Create(
     // Subclass again for purposes of dialog editing mode
     //
     SubclassWin(m_hWnd);
-    SetFont(pParent->GetFont());
+    wxFont*                          pButtonFont = new wxFont( 8
+                                                              ,wxSWISS
+                                                              ,wxNORMAL
+                                                              ,wxNORMAL
+                                                             );
+    SetFont(*pButtonFont);
+    SetXComp(0);
+    SetYComp(0);
     SetSize( rPos.x
             ,rPos.y
             ,rSize.x
             ,rSize.y
            );
+    delete pButtonFont;
     return TRUE;
 } // end of wxButton::Create
 
@@ -179,7 +180,7 @@ wxSize wxButton::GetDefaultSize()
     {
         wxScreenDC                  vDc;
 
-        vDc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+        vDc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
 
         //
         // The size of a standard button in the dialog units is 50x14,
@@ -317,7 +318,28 @@ void wxButton::MakeOwnerDrawn()
         lStyle |= BS_USERBUTTON;
         ::WinSetWindowULong(GetHwnd(), QWL_STYLE, lStyle);
     }
-} // end of wxCButton::MakeOwnerDrawn
+} // end of wxButton::MakeOwnerDrawn
+
+WXDWORD wxButton::OS2GetStyle(
+  long                              lStyle
+, WXDWORD*                          pdwExstyle
+) const
+{
+    //
+    // Buttons never have an external border, they draw their own one
+    //
+    WXDWORD                         dwStyle = wxControl::OS2GetStyle( (lStyle & ~wxBORDER_MASK) | wxBORDER_NONE
+                                                                     ,pdwExstyle
+                                                                    );
+
+    //
+    // We must use WS_CLIPSIBLINGS with the buttons or they would draw over
+    // each other in any resizeable dialog which has more than one button in
+    // the bottom
+    //
+    dwStyle |= WS_CLIPSIBLINGS;
+    return dwStyle;
+} // end of wxButton::OS2GetStyle
 
 MRESULT wxButton::WindowProc(
   WXUINT                            uMsg
@@ -361,5 +383,5 @@ MRESULT wxButton::WindowProc(
                                      ,wParam
                                      ,lParam
                                     ));
-} // end of wxW indowProc
+} // end of wxWindowProc