]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/winuniv.cpp
Reorder event things a little.
[wxWidgets.git] / src / univ / winuniv.cpp
index b1147291741290a84d9bd63baed89c1995c4ce25..7485272ce95f654acedafaca46db0d84e760bfb5 100644 (file)
@@ -124,20 +124,26 @@ bool wxWindow::Create(wxWindow *parent,
 {
     long actualStyle = style;
 
-    // FIXME: may need this on other platforms
-#ifdef __WXMSW__
+    // we add wxCLIP_CHILDREN to get the same ("natural") behaviour under MSW
+    // as under the other platforms
+    actualStyle |= wxCLIP_CHILDREN;
+
     actualStyle &= ~wxVSCROLL;
     actualStyle &= ~wxHSCROLL;
+
+#ifdef __WXMSW__
+    // without this, borders (non-client areas in general) are not repainted
+    // correctly when resizing; apparently, native NC areas are fully repainted
+    // even without this style by MSW, but wxUniv implements client area
+    // itself, so it doesn't work correctly for us
+    //
+    // FIXME: this is very expensive, we need to fix the (commented-out) code
+    //        in OnSize() instead
+    actualStyle |= wxFULL_REPAINT_ON_RESIZE;
 #endif
 
-    // we add wxCLIP_CHILDREN to get the same ("natural") behaviour under MSW
-    // as under the other platforms
-    if ( !wxWindowNative::Create(parent, id, pos, size,
-                                 actualStyle | wxCLIP_CHILDREN,
-                                 name) )
-    {
+    if ( !wxWindowNative::Create(parent, id, pos, size, actualStyle, name) )
         return false;
-    }
 
     // Set full style again, including those we didn't want present
     // when calling the base window Create().
@@ -190,6 +196,14 @@ wxWindow::~wxWindow()
 {
     m_isBeingDeleted = true;
 
+#if wxUSE_SCROLLBAR
+    // clear pointers to scrollbar before deleting the children: they are
+    // children and so will be deleted by DestroyChildren() call below and if
+    // any code using the scrollbars would be called in the process or from
+    // ~wxWindowBase, the app would crash:
+    m_scrollbarVert = m_scrollbarHorz = NULL;
+#endif
+
     // we have to destroy our children before we're destroyed because our
     // children suppose that we're of type wxWindow, not just wxWindowNative,
     // and so bad things may happen if they're deleted from the base class dtor