]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toplevel.cpp
added wxRESERVE_SPACE_EVEN_IF_HIDDEN sizer flag that prevents the sizer from changing...
[wxWidgets.git] / src / msw / toplevel.cpp
index a7217b5c9181c7196494004af13848519807aee6..f87a9827358e98aedce67319b35455759fd780bf 100644 (file)
@@ -507,9 +507,6 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
 {
     bool ret wxDUMMY_INITIALIZE(false);
 
-    // init our fields
-    Init();
-
     wxSize sizeReal = size;
     if ( !sizeReal.IsFullySpecified() )
     {
@@ -660,10 +657,14 @@ bool wxTopLevelWindowMSW::Show(bool show)
         }
         else // just show
         {
-           if ( GetWindowStyle() & wxFRAME_TOOL_WINDOW )
-               nShowCmd = SW_SHOWNA;
-           else
-               nShowCmd = SW_SHOW;
+            // we shouldn't use SW_SHOW which also activates the window for
+            // tool frames (as they shouldn't steal focus from the main window)
+            // nor for the currently disabled windows as they would be enabled
+            // as a side effect
+            if ( HasFlag(wxFRAME_TOOL_WINDOW) || !IsEnabled() )
+                nShowCmd = SW_SHOWNA;
+            else
+                nShowCmd = SW_SHOW;
         }
     }
     else // hide
@@ -1172,56 +1173,16 @@ bool wxTopLevelWindowMSW::CanSetTransparent()
 }
 
 
-void wxTopLevelWindowMSW::Freeze()
+void wxTopLevelWindowMSW::DoFreeze()
 {
-    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();
-            }
-        }
-    }
+    // do nothing: freezing toplevel window causes paint and mouse events
+    // to go through it any TLWs under it, so the best we can do is to freeze
+    // all children -- and wxWindowBase::Freeze() does that
 }
 
-void wxTopLevelWindowMSW::Thaw()
+void wxTopLevelWindowMSW::DoThaw()
 {
-    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);
+    // intentionally empty -- see DoFreeze()
 }
 
 
@@ -1237,7 +1198,7 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event)
     {
         // restore focus to the child which was last focused unless we already
         // have it
-        wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), (int) m_hWnd);
+        wxLogTrace(_T("focus"), _T("wxTLW %p activated."), m_hWnd);
 
         wxWindow *winFocus = FindFocus();
         if ( !winFocus || wxGetTopLevelParent(winFocus) != this )
@@ -1270,10 +1231,9 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event)
         }
 
         wxLogTrace(_T("focus"),
-                   _T("wxTLW %08x deactivated, last focused: %08x."),
-                   (int) m_hWnd,
-                   (int) (m_winLastFocused ? GetHwndOf(m_winLastFocused)
-                                           : NULL));
+                   _T("wxTLW %p deactivated, last focused: %p."),
+                   m_hWnd,
+                   m_winLastFocused ? GetHwndOf(m_winLastFocused) : NULL);
 
         event.Skip();
     }