]> git.saurik.com Git - wxWidgets.git/commitdiff
support for simulating focus events since not all controls can be focused
authorStefan Csomor <csomor@advancedconcepts.ch>
Tue, 27 Nov 2012 19:09:41 +0000 (19:09 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Tue, 27 Nov 2012 19:09:41 +0000 (19:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73044 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/window.h
src/osx/window_osx.cpp

index c97e979c8a8b113de4afc2f239b81cd8153b626f..3cfa8817f21bcf2da4c5856055bef411e93fcd10 100644 (file)
@@ -286,6 +286,7 @@ public:
 
     virtual bool        OSXHandleClicked( double timestampsec );
     virtual bool        OSXHandleKeyEvent( wxKeyEvent& event );
 
     virtual bool        OSXHandleClicked( double timestampsec );
     virtual bool        OSXHandleKeyEvent( wxKeyEvent& event );
+    virtual void        OSXSimulateFocusEvents();
 
     bool                IsNativeWindowWrapper() const { return m_isNativeWindowWrapper; }
     
 
     bool                IsNativeWindowWrapper() const { return m_isNativeWindowWrapper; }
     
index 6fe7e14929b71efe8f54c99a40fb0331c13bedb0..fadfabf4bd848ce28757db0f879d4b9bd5eeb844 100644 (file)
@@ -602,6 +602,25 @@ void wxWindowMac::SetFocus()
     GetPeer()->SetFocus() ;
 }
 
     GetPeer()->SetFocus() ;
 }
 
+void wxWindowMac::OSXSimulateFocusEvents()
+{
+    wxWindow* former = FindFocus() ;
+    if ( former != NULL && former != this )
+    {
+        {
+            wxFocusEvent event( wxEVT_KILL_FOCUS, former->GetId());
+            event.SetEventObject(former);
+            former->HandleWindowEvent(event) ;
+        }
+
+        {
+            wxFocusEvent event(wxEVT_SET_FOCUS, former->GetId());
+            event.SetEventObject(former);
+            former->HandleWindowEvent(event);
+        }
+    }
+}
+
 void wxWindowMac::DoCaptureMouse()
 {
     wxApp::s_captureWindow = (wxWindow*) this ;
 void wxWindowMac::DoCaptureMouse()
 {
     wxApp::s_captureWindow = (wxWindow*) this ;