git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11302
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply)
{
OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply)
{
ProcessSerialNumber PSN ;
PSN.highLongOfPSN = 0 ;
PSN.lowLongOfPSN = kCurrentProcess ;
ProcessSerialNumber PSN ;
PSN.highLongOfPSN = 0 ;
PSN.lowLongOfPSN = kCurrentProcess ;
wxPanel *panel = wxDynamicCast(parent, wxPanel);
if ( panel )
{
wxPanel *panel = wxDynamicCast(parent, wxPanel);
if ( panel )
{
- btnOldDefault = panel->GetDefaultItem();
+ btnOldDefault = wxDynamicCast(panel->GetDefaultItem(),
+ wxButton);
panel->SetDefaultItem(this);
}
panel->SetDefaultItem(this);
}
OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply)
{
OSErr wxApp::MacHandleAEODoc(const AppleEvent *event , AppleEvent *reply)
{
ProcessSerialNumber PSN ;
PSN.highLongOfPSN = 0 ;
PSN.lowLongOfPSN = kCurrentProcess ;
ProcessSerialNumber PSN ;
PSN.highLongOfPSN = 0 ;
PSN.lowLongOfPSN = kCurrentProcess ;
wxPanel *panel = wxDynamicCast(parent, wxPanel);
if ( panel )
{
wxPanel *panel = wxDynamicCast(parent, wxPanel);
if ( panel )
{
- btnOldDefault = panel->GetDefaultItem();
+ btnOldDefault = wxDynamicCast(panel->GetDefaultItem(),
+ wxButton);
panel->SetDefaultItem(this);
}
panel->SetDefaultItem(this);
}
}
if ( panel && panel->GetDefaultItem() )
{
}
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
}
}
//else: multiline controls need Enter for themselves
}
#endif // wxUSE_CARET
// panel wants to track the window which was the last to have focus in it
}
#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() )
#ifndef __WXUNIVERSAL__
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() )
// 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
// 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);
}
if ( panel && panel->GetDefaultItem() )
{
}
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
}
}
//else: multiline controls need Enter for themselves
}
#endif // wxUSE_CARET
// panel wants to track the window which was the last to have focus in it
}
#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() )
#ifndef __WXUNIVERSAL__
wxControl* control = wxDynamicCast( gFocusWindow , wxControl ) ;
if ( control && control->GetMacControl() )
// 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
// 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);