From: Stefan Csomor Date: Mon, 6 Aug 2001 15:57:14 +0000 (+0000) Subject: corrected mac src due to new api changes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c1fb8167e9d3bb0d62749d58fe6c9a5afc1bd3e3 corrected mac src due to new api changes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11302 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/image/makemac6.mcp b/samples/image/makemac6.mcp new file mode 100644 index 0000000000..84afd5e9c3 Binary files /dev/null and b/samples/image/makemac6.mcp differ diff --git a/src/mac/app.cpp b/src/mac/app.cpp index 8ad21ed778..efd6012932 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -138,6 +138,7 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigne OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply) { + SysBeep(40) ; ProcessSerialNumber PSN ; PSN.highLongOfPSN = 0 ; PSN.lowLongOfPSN = kCurrentProcess ; diff --git a/src/mac/button.cpp b/src/mac/button.cpp index 363789a945..e8a9b079b6 100644 --- a/src/mac/button.cpp +++ b/src/mac/button.cpp @@ -53,7 +53,8 @@ void wxButton::SetDefault() wxPanel *panel = wxDynamicCast(parent, wxPanel); if ( panel ) { - btnOldDefault = panel->GetDefaultItem(); + btnOldDefault = wxDynamicCast(panel->GetDefaultItem(), + wxButton); panel->SetDefaultItem(this); } diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 8ad21ed778..efd6012932 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -138,6 +138,7 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigne OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply) { + SysBeep(40) ; ProcessSerialNumber PSN ; PSN.highLongOfPSN = 0 ; PSN.lowLongOfPSN = kCurrentProcess ; diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index 363789a945..e8a9b079b6 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -53,7 +53,8 @@ void wxButton::SetDefault() wxPanel *panel = wxDynamicCast(parent, wxPanel); if ( panel ) { - btnOldDefault = panel->GetDefaultItem(); + btnOldDefault = wxDynamicCast(panel->GetDefaultItem(), + wxButton); panel->SetDefaultItem(this); } diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 69da2912c7..f522366b32 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -680,12 +680,15 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) } if ( panel && panel->GetDefaultItem() ) { - wxButton *def = panel->GetDefaultItem() ; - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); - event.SetEventObject(def); - def->Command(event); - event.Skip() ; - return ; + wxButton *def = wxDynamicCast(panel->GetDefaultItem(), + wxButton); + if ( def && def->IsEnabled() ) + { + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); + event.SetEventObject(def); + def->Command(event); + return ; + } } } //else: multiline controls need Enter for themselves diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 32f583f2ec..3f12059d91 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -264,11 +264,9 @@ void wxWindowMac::SetFocus() } #endif // wxUSE_CARET // panel wants to track the window which was the last to have focus in it - wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); - if ( panel ) - { - panel->SetLastFocus((wxWindow*)this); - } + wxChildFocusEvent eventFocus(this); + (void)GetEventHandler()->ProcessEvent(eventFocus); + #ifndef __WXUNIVERSAL__ wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ; if ( control && control->GetMacControl() ) @@ -1482,18 +1480,10 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) // notice that it's also important to do it upwards the tree becaus // otherwise when the top level panel gets focus, it won't set it back to // us, but to some other sibling - wxWindowMac *win = this; - while ( win ) - { - wxWindowMac *parent = win->GetParent(); - wxPanel *panel = wxDynamicCast(parent, wxPanel); - if ( panel ) - { - panel->SetLastFocus(win); - } - - win = parent; - } + + // CS:don't know if this is still needed: + //wxChildFocusEvent eventFocus(this); + //(void)GetEventHandler()->ProcessEvent(eventFocus); event.Skip(); } diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 69da2912c7..f522366b32 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -680,12 +680,15 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) } if ( panel && panel->GetDefaultItem() ) { - wxButton *def = panel->GetDefaultItem() ; - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); - event.SetEventObject(def); - def->Command(event); - event.Skip() ; - return ; + wxButton *def = wxDynamicCast(panel->GetDefaultItem(), + wxButton); + if ( def && def->IsEnabled() ) + { + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); + event.SetEventObject(def); + def->Command(event); + return ; + } } } //else: multiline controls need Enter for themselves diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 32f583f2ec..3f12059d91 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -264,11 +264,9 @@ void wxWindowMac::SetFocus() } #endif // wxUSE_CARET // panel wants to track the window which was the last to have focus in it - wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); - if ( panel ) - { - panel->SetLastFocus((wxWindow*)this); - } + wxChildFocusEvent eventFocus(this); + (void)GetEventHandler()->ProcessEvent(eventFocus); + #ifndef __WXUNIVERSAL__ wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ; if ( control && control->GetMacControl() ) @@ -1482,18 +1480,10 @@ void wxWindowMac::OnSetFocus(wxFocusEvent& event) // notice that it's also important to do it upwards the tree becaus // otherwise when the top level panel gets focus, it won't set it back to // us, but to some other sibling - wxWindowMac *win = this; - while ( win ) - { - wxWindowMac *parent = win->GetParent(); - wxPanel *panel = wxDynamicCast(parent, wxPanel); - if ( panel ) - { - panel->SetLastFocus(win); - } - - win = parent; - } + + // CS:don't know if this is still needed: + //wxChildFocusEvent eventFocus(this); + //(void)GetEventHandler()->ProcessEvent(eventFocus); event.Skip(); } diff --git a/src/makemac6.mcp b/src/makemac6.mcp index 3041dd62b0..3c6efd0e39 100644 Binary files a/src/makemac6.mcp and b/src/makemac6.mcp differ