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
This commit is contained in:
Stefan Csomor
2001-08-06 15:57:14 +00:00
parent 6b55490abd
commit c1fb8167e9
10 changed files with 38 additions and 48 deletions

BIN
samples/image/makemac6.mcp Normal file

Binary file not shown.

View File

@@ -138,6 +138,7 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigne
OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply) OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply)
{ {
SysBeep(40) ;
ProcessSerialNumber PSN ; ProcessSerialNumber PSN ;
PSN.highLongOfPSN = 0 ; PSN.highLongOfPSN = 0 ;
PSN.lowLongOfPSN = kCurrentProcess ; PSN.lowLongOfPSN = kCurrentProcess ;

View File

@@ -53,7 +53,8 @@ void wxButton::SetDefault()
wxPanel *panel = wxDynamicCast(parent, wxPanel); wxPanel *panel = wxDynamicCast(parent, wxPanel);
if ( panel ) if ( panel )
{ {
btnOldDefault = panel->GetDefaultItem(); btnOldDefault = wxDynamicCast(panel->GetDefaultItem(),
wxButton);
panel->SetDefaultItem(this); panel->SetDefaultItem(this);
} }

View File

@@ -138,6 +138,7 @@ pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigne
OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply) OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply)
{ {
SysBeep(40) ;
ProcessSerialNumber PSN ; ProcessSerialNumber PSN ;
PSN.highLongOfPSN = 0 ; PSN.highLongOfPSN = 0 ;
PSN.lowLongOfPSN = kCurrentProcess ; PSN.lowLongOfPSN = kCurrentProcess ;

View File

@@ -53,7 +53,8 @@ void wxButton::SetDefault()
wxPanel *panel = wxDynamicCast(parent, wxPanel); wxPanel *panel = wxDynamicCast(parent, wxPanel);
if ( panel ) if ( panel )
{ {
btnOldDefault = panel->GetDefaultItem(); btnOldDefault = wxDynamicCast(panel->GetDefaultItem(),
wxButton);
panel->SetDefaultItem(this); panel->SetDefaultItem(this);
} }

View File

@@ -680,14 +680,17 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
} }
if ( panel && panel->GetDefaultItem() ) if ( panel && panel->GetDefaultItem() )
{ {
wxButton *def = panel->GetDefaultItem() ; wxButton *def = wxDynamicCast(panel->GetDefaultItem(),
wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
event.SetEventObject(def); event.SetEventObject(def);
def->Command(event); def->Command(event);
event.Skip() ;
return ; return ;
} }
} }
}
//else: multiline controls need Enter for themselves //else: multiline controls need Enter for themselves
break; break;

View File

@@ -264,11 +264,9 @@ void wxWindowMac::SetFocus()
} }
#endif // wxUSE_CARET #endif // wxUSE_CARET
// panel wants to track the window which was the last to have focus in it // panel wants to track the window which was the last to have focus in it
wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); wxChildFocusEvent eventFocus(this);
if ( panel ) (void)GetEventHandler()->ProcessEvent(eventFocus);
{
panel->SetLastFocus((wxWindow*)this);
}
#ifndef __WXUNIVERSAL__ #ifndef __WXUNIVERSAL__
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ; wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() ) 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 // 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 // otherwise when the top level panel gets focus, it won't set it back to
// us, but to some other sibling // 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(); event.Skip();
} }

View File

@@ -680,14 +680,17 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
} }
if ( panel && panel->GetDefaultItem() ) if ( panel && panel->GetDefaultItem() )
{ {
wxButton *def = panel->GetDefaultItem() ; wxButton *def = wxDynamicCast(panel->GetDefaultItem(),
wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
event.SetEventObject(def); event.SetEventObject(def);
def->Command(event); def->Command(event);
event.Skip() ;
return ; return ;
} }
} }
}
//else: multiline controls need Enter for themselves //else: multiline controls need Enter for themselves
break; break;

View File

@@ -264,11 +264,9 @@ void wxWindowMac::SetFocus()
} }
#endif // wxUSE_CARET #endif // wxUSE_CARET
// panel wants to track the window which was the last to have focus in it // panel wants to track the window which was the last to have focus in it
wxPanel *panel = wxDynamicCast(GetParent(), wxPanel); wxChildFocusEvent eventFocus(this);
if ( panel ) (void)GetEventHandler()->ProcessEvent(eventFocus);
{
panel->SetLastFocus((wxWindow*)this);
}
#ifndef __WXUNIVERSAL__ #ifndef __WXUNIVERSAL__
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ; wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() ) 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 // 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 // otherwise when the top level panel gets focus, it won't set it back to
// us, but to some other sibling // 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(); event.Skip();
} }

Binary file not shown.