]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/textctrl.mm
Move body of SetMinSize and SetMaxSize from header to cpp file for easier debugging...
[wxWidgets.git] / src / osx / cocoa / textctrl.mm
index 16881be7c73da9193a69e9d253232ff67a8bb364..3e5b8d87e79d5b7fd771bde8bfee1d3e2fc88d82 100644 (file)
 
 WXCOCOAIMPL_COMMON_IMPLEMENTATION
 
+- (id)initWithFrame:(NSRect)frame
+{
+    [super initWithFrame:frame];
+    impl = NULL;
+    [self setDelegate: self];
+    [self setTarget: self];
+//    [self setAction: @selector(enterAction:)];
+    return self;
+}
+
 // use our common calls
 - (void) setTitle:(NSString *) title
 {
     [self setStringValue: title];
 }
+/*
+- (void)controlTextDidChange:(NSNotification *)aNotification
+{
+    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 );
+        }
+    }
+}
+
+- (void)controlTextDidEndEditing:(NSNotification *)aNotification
+{
+    if ( impl )
+    {
+        wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
+        if ( wxpeer ) {
+            wxFocusEvent event(wxEVT_KILL_FOCUS, wxpeer->GetId());
+            event.SetEventObject( wxpeer );
+            event.SetWindow( wxpeer );
+            wxpeer->HandleWindowEvent( event );
+        }
+    }
+}
 
+- (void) enterAction: (id) sender
+{
+    if ( impl )
+    {
+        wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
+        if ( wxpeer && (wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER) ) {
+            wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, wxpeer->GetId());
+            event.SetEventObject( wxpeer );
+            event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
+            wxpeer->HandleWindowEvent( event );
+        }
+    }
+}
+*/
 @end
 
 wxNSTextFieldControl::wxNSTextFieldControl( wxTextCtrl *wxPeer, WXWidget w ) : wxWidgetCocoaImpl(wxPeer, w)
@@ -97,6 +149,7 @@ bool wxNSTextFieldControl::CanPaste() const
 
 void wxNSTextFieldControl::SetEditable(bool editable) 
 {
+    [(wxNSTextField*) m_osxView setEditable:editable];
 }
 
 void wxNSTextFieldControl::GetSelection( long* from, long* to) const