moving tlw list up, cleanup

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-03-25 21:34:30 +00:00
parent c822d4ca20
commit 328f0df87c
6 changed files with 30 additions and 41 deletions

View 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 );
}
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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 ;
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 );
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() );