]> git.saurik.com Git - wxWidgets.git/commitdiff
moving tlw list up, cleanup
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 25 Mar 2008 21:34:30 +0000 (21:34 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 25 Mar 2008 21:34:30 +0000 (21:34 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/dialog.cpp
src/mac/carbon/frame.cpp
src/mac/carbon/mdi.cpp
src/mac/carbon/nonownedwnd.cpp
src/mac/carbon/toplevel.cpp
src/mac/carbon/window.cpp

index bb90e3812be7a6cb83f3cdfd81eca38da74de30b..8743e10547df6dec7c4dde3ea3e333b79df154aa 100644 (file)
@@ -62,15 +62,11 @@ void wxDialog::SetModal( bool flag )
     {
         m_isModalStyle = true;
 
-        wxModelessWindows.DeleteObject( this );
-
         SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
     }
     else
     {
         m_isModalStyle = false;
-
-        wxModelessWindows.Append( this );
     }
 }
 
index b4da3e565f4811e0a434d6d681b06343f37d4486..d17d5d8147f1c04a58c77ed732dee84fe8e52291 100644 (file)
@@ -26,8 +26,6 @@
 
 #include "wx/mac/uma.h"
 
-extern wxWindowList wxModelessWindows;
-
 BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
   EVT_ACTIVATE(wxFrame::OnActivate)
  // EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
@@ -61,8 +59,6 @@ bool wxFrame::Create(wxWindow *parent,
     if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
         return false;
 
-    wxModelessWindows.Append(this);
-
     return true;
 }
 
index ff52663afcdd4adc4bacdb7a1d8cd13f603b792d..6fd6dfae0df05bca9395352c4a3550c7fcce487e 100644 (file)
@@ -25,8 +25,6 @@
 #include "wx/mac/private.h"
 #include "wx/mac/uma.h"
 
-extern wxWindowList wxModelessWindows;
-
 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
@@ -396,8 +394,6 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
 
     SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
 
-    wxModelessWindows.Append(this);
-
     return true;
 }
 
@@ -500,8 +496,6 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
     if ( !wxWindow::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style) )
         return false;
 
-    wxModelessWindows.Append(this);
-
     return true;
 }
 
index c6d9c288415a281de380401c26fc63cdc3b41b9d..1a1adedf1043d2de83ee814144c56c35a77095fa 100644 (file)
@@ -42,9 +42,6 @@
 // globals
 // ----------------------------------------------------------------------------
 
-// list of all frames and modeless dialogs
-wxWindowList       wxModelessWindows;
-
 static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 message, SInt32 param);
 
 // ============================================================================
@@ -852,8 +849,6 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
     if (GetExtraStyle() & wxFRAME_EX_METAL)
         MacSetMetalAppearance(true);
 
-    wxTopLevelWindows.Append(this);
-
     if ( parent )
         parent->AddChild(this);
 
@@ -878,9 +873,6 @@ wxNonOwnedWindow::~wxNonOwnedWindow()
 
     wxRemoveMacWindowAssociation( this ) ;
 
-    if ( wxModelessWindows.Find(this) )
-        wxModelessWindows.DeleteObject(this);
-
     // avoid dangling refs
     if ( s_macDeactivateWindow == this )
         s_macDeactivateWindow = NULL;
@@ -903,7 +895,7 @@ 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)) )
@@ -916,6 +908,10 @@ bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c )
         SetThemeWindowBackground( (WindowRef) m_macWindow,  kThemeBrushDialogBackgroundActive, false ) ;
         SetBackgroundStyle(wxBG_STYLE_CUSTOM);
     }
+    else
+    {
+        SetBackgroundStyle(wxBG_STYLE_COLOUR);
+    }
     return true;
 }    
 
index cc75ba34c39889dc668be09b00113474f3e8d896..9398f003e1511750eb90a87900cd974c3628323d 100644 (file)
@@ -91,6 +91,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
 
     wxWindow::SetLabel( title ) ;
     SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , GetFont().GetEncoding() ) );
+    wxTopLevelWindows.Append(this);
 
     return true;
 }
index e4cb57c133b3d18844f14afb20640395ebfe1f7c..c283e6472f104a28cbcf8f71c4dd4ab1a56aac04 100644 (file)
@@ -415,28 +415,31 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                 {
 // set back to 0 if problems arise
 #if 1
-                    ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
-                    // synthesize the event focus changed event
-                    EventRef evRef = NULL ;
-
-                    OSStatus err = MacCreateEvent(
-                                         NULL , kEventClassControl , kEventControlFocusPartChanged , TicksToEventTime( TickCount() ) ,
-                                         kEventAttributeUserEvent , &evRef );
-                    verify_noerr( err );
-
-                    wxMacCarbonEvent iEvent( evRef ) ;
-                    iEvent.SetParameter<ControlRef>( kEventParamDirectObject , controlRef );
-                    iEvent.SetParameter<EventTargetRef>( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) );
-                    iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart );
-                    iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart );
-
+                    if ( result == noErr )
+                    {
+                        ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
+                        // synthesize the event focus changed event
+                        EventRef evRef = NULL ;
+
+                        OSStatus err = MacCreateEvent(
+                                             NULL , kEventClassControl , kEventControlFocusPartChanged , TicksToEventTime( TickCount() ) ,
+                                             kEventAttributeUserEvent , &evRef );
+                        verify_noerr( err );
+
+                        wxMacCarbonEvent iEvent( evRef ) ;
+                        iEvent.SetParameter<ControlRef>( kEventParamDirectObject , controlRef );
+                        iEvent.SetParameter<EventTargetRef>( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) );
+                        iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart );
+                        iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart );
+        
 #if 1
-                    // TODO test this first, avoid double posts etc...
-                    PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
+                        // TODO test this first, avoid double posts etc...
+                        PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
 #else
-                    wxMacWindowControlEventHandler( NULL , evRef , data ) ;
+                        wxMacWindowControlEventHandler( NULL , evRef , data ) ;
 #endif
-                    ReleaseEvent( evRef ) ;
+                        ReleaseEvent( evRef ) ;
+                    }
 #else
                     // old implementation, to be removed if the new one works
                     if ( controlPart == kControlFocusNoPart )
@@ -1203,10 +1206,13 @@ void wxWindowMac::SetFocus()
 
     // as we cannot rely on the control features to find out whether we are in full keyboard mode,
     // we can only leave in case of an error
-    wxLogTrace(_T("Focus"), _T("before wxWindow::SetFocus(%p)"), wx_static_cast(void*, this));
+    wxLogTrace(_T("Focus"), _T("before wxWindow::SetFocus(%p) %d"), wx_static_cast(void*, this), GetName().c_str());
     OSStatus err = m_peer->SetFocus( kControlFocusNextPart ) ;
     if ( err == errCouldntSetFocus )
+    {
+        wxLogTrace(_T("Focus"), _T("in wxWindow::SetFocus(%p) errCouldntSetFocus"), wx_static_cast(void*, this));
         return ;
+    }
     wxLogTrace(_T("Focus"), _T("after wxWindow::SetFocus(%p)"), wx_static_cast(void*, this));
 
     SetUserFocusWindow( (WindowRef)MacGetTopLevelWindowRef() );