]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/textctrl.mm
Correct format specifiers used to show wxIPV4address.
[wxWidgets.git] / src / osx / cocoa / textctrl.mm
index c288d787039cd60fdaefa76c9fee0b52eb252048..accef767a8415e5beabff4925a701c7ddc323143 100644 (file)
@@ -96,15 +96,7 @@ protected :
     wxUnusedVar(aNotification);
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
-    {
-        wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
-        if ( wxpeer ) {
-            wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId());
-            event.SetEventObject( wxpeer );
-            event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
-            wxpeer->HandleWindowEvent( event );
-        }
-    }
+        impl->controlTextDidChange();
 }
 
 - (void)controlTextDidEndEditing:(NSNotification *)aNotification
@@ -194,17 +186,10 @@ protected :
 
 - (void)textDidChange:(NSNotification *)aNotification
 {
-    wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( [aNotification object] );
+    wxUnusedVar(aNotification);
+    wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
-    {
-        wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
-        if ( wxpeer ) {
-            wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId());
-            event.SetEventObject( wxpeer );
-            event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
-            wxpeer->HandleWindowEvent( event );
-        }
-    }
+        impl->controlTextDidChange();
 }
 
 @end
@@ -244,7 +229,6 @@ protected :
     return fieldEditor;
 }
 
-
 - (void) setEnabled:(BOOL) flag
 {
     [super setEnabled: flag];
@@ -266,15 +250,7 @@ protected :
     wxUnusedVar(aNotification);
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
-    {
-        wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
-        if ( wxpeer ) {
-            wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId());
-            event.SetEventObject( wxpeer );
-            event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
-            wxpeer->HandleWindowEvent( event );
-        }
-    }
+        impl->controlTextDidChange();
 }
 
 typedef BOOL (*wxOSX_insertNewlineHandlerPtr)(NSView* self, SEL _cmd, NSControl *control, NSTextView* textView, SEL commandSelector);
@@ -345,6 +321,14 @@ wxNSTextViewControl::~wxNSTextViewControl()
         [m_textView setDelegate: nil];
 }
 
+bool wxNSTextViewControl::CanFocus() const
+{
+    // since this doesn't work (return false), we hardcode
+    // if (m_textView)
+    //    return [m_textView canBecomeKeyView];
+    return true;
+}
+
 wxString wxNSTextViewControl::GetStringValue() const
 {
     if (m_textView)