]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toplevel.cpp
Fix from Hartwig
[wxWidgets.git] / src / msw / toplevel.cpp
index 712dce227271add003830ea40ca590fe97ddb9a9..57e85c391357ed0d9c361e90be360b9243569892 100644 (file)
@@ -221,9 +221,11 @@ WXDWORD wxTopLevelWindowMSW::MSWGetStyle(long style, WXDWORD *exflags) const
     }
 
 #ifndef __WXWINCE__
-    if ( style & wxSYSTEM_MENU )
+    // notice that if wxCLOSE_BOX is specified we need to use WS_SYSMENU too as
+    // otherwise the close box doesn't appear
+    if ( style & (wxSYSTEM_MENU | wxCLOSE_BOX) )
         msflags |= WS_SYSMENU;
-#endif
+#endif // !__WXWINCE__
 
     // NB: under CE these 2 styles are not supported currently, we should
     //     call Minimize()/Maximize() "manually" if we want to support them
@@ -1168,6 +1170,60 @@ bool wxTopLevelWindowMSW::CanSetTransparent()
     return (os_type == wxOS_WINDOWS_NT && ver_major >= 5);
 }
 
+
+void wxTopLevelWindowMSW::Freeze()
+{
+    if ( !m_frozenness++) {
+        if (IsShown()) {
+            for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+                node;
+                node = node->GetNext() )
+            {
+                wxWindow *child = node->GetData();
+                if ( child->IsTopLevel() )
+                    continue;
+                else
+                    child->Freeze();
+            }
+        }
+    }
+}
+
+void wxTopLevelWindowMSW::Thaw()
+{
+    wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
+    if ( --m_frozenness == 0 )
+    {
+        if ( IsShown() ) {
+            for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+                node;
+                node = node->GetNext() )
+            {
+                wxWindow *child = node->GetData();
+                if ( child->IsTopLevel() )
+                    continue;
+                else
+                    child->Thaw();
+            }
+        }
+    }
+}
+
+
+void wxTopLevelWindowMSW::AddChild(wxWindowBase *child )
+{
+    //adding a child while frozen will assert when thawn,
+    // so freeze it
+    if (child && !child->IsTopLevel() && IsFrozen()) {
+        //need to match our current freeze level
+        for (unsigned int ii=0;ii< m_frozenness;ii++) {
+            child->Freeze();
+        }
+    }
+    wxTopLevelWindowBase::AddChild(child);
+}
+
+
 // ----------------------------------------------------------------------------
 // wxTopLevelWindow event handling
 // ----------------------------------------------------------------------------