]> git.saurik.com Git - wxWidgets.git/commitdiff
corrected mac src due to new api changes
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 6 Aug 2001 15:57:14 +0000 (15:57 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 6 Aug 2001 15:57:14 +0000 (15:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11302 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/image/makemac6.mcp [new file with mode: 0644]
src/mac/app.cpp
src/mac/button.cpp
src/mac/carbon/app.cpp
src/mac/carbon/button.cpp
src/mac/carbon/textctrl.cpp
src/mac/carbon/window.cpp
src/mac/textctrl.cpp
src/mac/window.cpp
src/makemac6.mcp

diff --git a/samples/image/makemac6.mcp b/samples/image/makemac6.mcp
new file mode 100644 (file)
index 0000000..84afd5e
Binary files /dev/null and b/samples/image/makemac6.mcp differ
index 8ad21ed77879e50abd52277b912d90a29471bd67..efd601293271c43b9aa5b887cb55d64a7ddad87e 100644 (file)
@@ -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 ;
index 363789a94521f979fce8ee9dfeba079f9c44fee1..e8a9b079b62e2aef6f56e8e6326d68e208356ce2 100644 (file)
@@ -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);
     }
 
index 8ad21ed77879e50abd52277b912d90a29471bd67..efd601293271c43b9aa5b887cb55d64a7ddad87e 100644 (file)
@@ -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 ;
index 363789a94521f979fce8ee9dfeba079f9c44fee1..e8a9b079b62e2aef6f56e8e6326d68e208356ce2 100644 (file)
@@ -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);
     }
 
index 69da2912c7daa85033ac7e96be0cfb1952891271..f522366b3204fe4ce60e0bb6186f17c0ba2119f7 100644 (file)
@@ -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
index 32f583f2eca9d66c77c581e8c9bd2a0df3f02990..3f12059d91609262b60b03faae0c910d66c973b4 100644 (file)
@@ -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();
 }
index 69da2912c7daa85033ac7e96be0cfb1952891271..f522366b3204fe4ce60e0bb6186f17c0ba2119f7 100644 (file)
@@ -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
index 32f583f2eca9d66c77c581e8c9bd2a0df3f02990..3f12059d91609262b60b03faae0c910d66c973b4 100644 (file)
@@ -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();
 }
index 3041dd62b0133c6b070a5d3a9492df5f6f90a78b..3c6efd0e391f676aae45df2ce4fbc11e7428c182 100644 (file)
Binary files a/src/makemac6.mcp and b/src/makemac6.mcp differ