]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/toplevel.cpp
restore generic DrawEllipticArc() used by CE which was lost during the great wxDC...
[wxWidgets.git] / src / msw / toplevel.cpp
index 86ac85d33e99f3dcd0cfa6fe738dd2409a64e3b6..d0e47ea963779007705bf202e56f843aff7608f3 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
@@ -658,10 +660,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
@@ -933,7 +939,7 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style)
 
         // finally send an event allowing the window to relayout itself &c
         wxSizeEvent event(rect.GetSize(), GetId());
-        GetEventHandler()->ProcessEvent(event);
+        HandleWindowEvent(event);
     }
     else // stop showing full screen
     {
@@ -963,25 +969,26 @@ wxString wxTopLevelWindowMSW::GetTitle() const
     return GetLabel();
 }
 
-void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
+void wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
+                                             int smX,
+                                             int smY,
+                                             int i)
 {
-    wxTopLevelWindowBase::SetIcons(icons);
+    const wxSize size(::GetSystemMetrics(smX), ::GetSystemMetrics(smY));
 
-#if !defined(__WXMICROWIN__)
-    const wxIcon& sml = icons.GetIconOfExactSize(16);
-    if( sml.Ok() )
+    const wxIcon icon = icons.GetIconOfExactSize(size);
+    if ( icon.Ok() )
     {
-        ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_SMALL,
-                       (LPARAM)GetHiconOf(sml) );
+        ::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
     }
+}
 
-    const wxIcon& big = icons.GetIconOfExactSize(32);
-    if( big.Ok() )
-    {
-        ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_BIG,
-                       (LPARAM)GetHiconOf(big) );
-    }
-#endif // !__WXMICROWIN__
+void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
+{
+    wxTopLevelWindowBase::SetIcons(icons);
+
+    DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
+    DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG);
 }
 
 bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)
@@ -1168,6 +1175,55 @@ bool wxTopLevelWindowMSW::CanSetTransparent()
     return (os_type == wxOS_WINDOWS_NT && ver_major >= 5);
 }
 
+
+void wxTopLevelWindowMSW::DoFreeze()
+{
+    if ( IsShown() )
+    {
+        for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+              node;
+              node = node->GetNext() )
+        {
+            wxWindow *child = node->GetData();
+            if ( child->IsTopLevel() )
+                continue;
+
+            child->Freeze();
+        }
+    }
+}
+
+void wxTopLevelWindowMSW::DoThaw()
+{
+    if ( IsShown() )
+    {
+        for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
+              node;
+              node = node->GetNext() )
+        {
+            wxWindow *child = node->GetData();
+            if ( child->IsTopLevel() )
+                continue;
+
+            child->Thaw();
+        }
+    }
+}
+
+
+void wxTopLevelWindowMSW::AddChild(wxWindowBase *child)
+{
+    // adding a child while frozen will assert when thawn, so freeze it as if
+    // it had been already present when we were frozen
+    if ( child && !child->IsTopLevel() && IsFrozen() )
+    {
+        child->Freeze();
+    }
+
+    wxTopLevelWindowBase::AddChild(child);
+}
+
+
 // ----------------------------------------------------------------------------
 // wxTopLevelWindow event handling
 // ----------------------------------------------------------------------------