]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/nonownedwnd.cpp
implement wxLIST_AUTOSIZE support in wxMac's wxListCtrl
[wxWidgets.git] / src / mac / carbon / nonownedwnd.cpp
index 6f873b816b2e5982334d9904bacd006058aac227..c52ce3873858d0245bafab15de0a5547431f6035 100644 (file)
@@ -21,6 +21,8 @@
 #include "wx/nonownedwnd.h"
 
 #include "wx/mac/private.h"
+#include "wx/settings.h"
+#include "wx/frame.h"
 
 #if wxUSE_SYSTEM_OPTIONS
     #include "wx/sysopt.h"
 #define kWindowUnifiedTitleAndToolbarAttribute (1 << 7)
 
 // trace mask for activation tracing messages
-static const wxChar *TRACE_ACTIVATE = _T("activation");
+#define TRACE_ACTIVATE "activation"
 
 // ----------------------------------------------------------------------------
 // globals
 // ----------------------------------------------------------------------------
 
-// list of all frames and modeless dialogs
-wxWindowList       wxModelessWindows;
-
 static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
 
 // ============================================================================
@@ -850,8 +849,6 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
     if (GetExtraStyle() & wxFRAME_EX_METAL)
         MacSetMetalAppearance(true);
 
-    wxTopLevelWindows.Append(this);
-
     if ( parent )
         parent->AddChild(this);
 
@@ -876,9 +873,6 @@ wxNonOwnedWindow::~wxNonOwnedWindow()
 
     wxRemoveMacWindowAssociation( this ) ;
 
-    if ( wxModelessWindows.Find(this) )
-        wxModelessWindows.DeleteObject(this);
-
     // avoid dangling refs
     if ( s_macDeactivateWindow == this )
         s_macDeactivateWindow = NULL;
@@ -901,18 +895,21 @@ bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c )
     else if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) )
         col = wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive));
         
-    if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol )
+    if ( !wxWindow::SetBackgroundColour(col) && m_hasBgCol )
         return false ;
     
-    if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDocumentWindowBackground)) )
+    if ( GetBackgroundStyle() != wxBG_STYLE_CUSTOM )
     {
-        SetThemeWindowBackground( (WindowRef) m_macWindow,  kThemeBrushDocumentWindowBackground, false ) ;
-        SetBackgroundStyle(wxBG_STYLE_CUSTOM);
-    }
-    else if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)) )
-    {
-        SetThemeWindowBackground( (WindowRef) m_macWindow,  kThemeBrushDialogBackgroundActive, false ) ;
-        SetBackgroundStyle(wxBG_STYLE_CUSTOM);
+        if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDocumentWindowBackground)) )
+        {
+            SetThemeWindowBackground( (WindowRef) m_macWindow,  kThemeBrushDocumentWindowBackground, false ) ;
+            SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+        }
+        else if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)) )
+        {
+            SetThemeWindowBackground( (WindowRef) m_macWindow,  kThemeBrushDialogBackgroundActive, false ) ;
+            SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+        }
     }
     return true;
 }    
@@ -1003,17 +1000,19 @@ void  wxNonOwnedWindow::DoMacCreateRealWindow(
     }
     else if ( HasFlag( wxPOPUP_WINDOW ) )
     {
-        // TEMPORARY HACK!
-        // Until we've got a real wxPopupWindow class on wxMac make it a
-        // little easier for wxFrame to be used to emulate it and workaround
-        // the lack of wxPopupWindow.
         if ( HasFlag( wxBORDER_NONE ) )
+        {
             wclass = kHelpWindowClass ;   // has no border
+            attr |= kWindowNoShadowAttribute;
+        }
         else
+        {
             wclass = kPlainWindowClass ;  // has a single line border, it will have to do for now
-        //attr |= kWindowNoShadowAttribute; // turn off the shadow  Should we??
-        group = GetWindowGroupOfClass(    // float above other windows
-            kFloatingWindowClass) ;
+        }
+        group = GetWindowGroupOfClass(kFloatingWindowClass) ;
+        // make sure we don't deactivate something
+        activationScopeSet = true;
+        activationScope = kWindowActivationScopeNone;
     }
     else if ( HasFlag( wxCAPTION ) )
     {