X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b466e85a7e81db84545bc44c83cbe4ccacd4fe8e..e81c7155869a701afe700d1d41a26de9acfda80e:/src/osx/cocoa/textctrl.mm diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 16881be7c7..3e5b8d87e7 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -53,12 +53,64 @@ 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(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(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