]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/toplevel.cpp
conditionalized theme box drawing
[wxWidgets.git] / src / mac / toplevel.cpp
index a9acd84e2cd0acc0de9874549c89bf909319e4bc..3eb3b4787fc2e7151a7446e2293c69c50b51bdc2 100644 (file)
@@ -112,6 +112,21 @@ void wxTopLevelWindowMac::Init()
     m_macWindow = NULL ;
 }
 
+class wxMacDeferredWindowDeleter : public wxObject
+{
+public :
+    wxMacDeferredWindowDeleter( WindowRef windowRef ) 
+    { 
+        m_macWindow = windowRef ; 
+    }
+    virtual ~wxMacDeferredWindowDeleter() 
+    { 
+        UMADisposeWindow( (WindowRef) m_macWindow ) ; 
+    }
+ protected :
+    WindowRef m_macWindow ;
+} ;
+
 bool wxTopLevelWindowMac::Create(wxWindow *parent,
                                  wxWindowID id,
                                  const wxString& title,
@@ -142,7 +157,7 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
     if ( m_macWindow )
     {
         wxToolTip::NotifyWindowDelete(m_macWindow) ;
-        UMADisposeWindow( (WindowRef) m_macWindow ) ;
+        wxPendingDelete.Append( new wxMacDeferredWindowDeleter( (WindowRef) m_macWindow ) ) ;
     }
     
     wxRemoveMacWindowAssociation( this ) ;
@@ -241,12 +256,23 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     WindowClass wclass = 0;
     WindowAttributes attr = kWindowNoAttributes ;
     
-    if ( HasFlag( wxFRAME_TOOL_WINDOW) /*|| HasFlag(wxTINY_CAPTION_HORIZ) ||  HasFlag(wxTINY_CAPTION_VERT)*/ )
+    if ( HasFlag( wxFRAME_TOOL_WINDOW) )
     {
-        wclass = kFloatingWindowClass ;
-        if ( HasFlag(wxTINY_CAPTION_VERT) )
+        if ( 
+            HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
+            HasFlag( wxSYSTEM_MENU ) || HasFlag( wxCAPTION ) ||
+            HasFlag(wxTINY_CAPTION_HORIZ) ||  HasFlag(wxTINY_CAPTION_VERT)
+             )
         {
-            attr |= kWindowSideTitlebarAttribute ;
+            wclass = kFloatingWindowClass ;
+            if ( HasFlag(wxTINY_CAPTION_VERT) )
+            {
+                attr |= kWindowSideTitlebarAttribute ;
+            }
+        }
+        else
+        {
+            wclass = kPlainWindowClass ;
         }
     }
     else if ( HasFlag( wxCAPTION ) )
@@ -262,7 +288,15 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     }
     else
     {
-        wclass = kDocumentWindowClass ;
+        if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) ||
+             HasFlag( wxSYSTEM_MENU ) )
+        {
+            wclass = kDocumentWindowClass ;
+        }
+        else
+        {
+            wclass = kPlainWindowClass ;
+        }
     }
     
     if ( HasFlag( wxMINIMIZE_BOX ) || HasFlag( wxMAXIMIZE_BOX ) )