virtual void UpdateLineToEnd( unsigned int n);
virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender);
- virtual bool DoHandleKeyEvent(NSEvent *event);
protected :
wxNSTableView* m_tableView ;
list->HandleLineEvent( sel, true );
}
-bool wxListWidgetCocoaImpl::DoHandleKeyEvent(NSEvent *event)
-{
- wxKeyEvent wxevent(wxEVT_KEY_DOWN);
- SetupKeyEvent( wxevent, event );
- wxevent.SetEventObject(GetWXPeer());
- bool result = GetWXPeer()->OSXHandleKeyEvent(wxevent);
-
- // no interpretKeyEvents here, but rerouting to native keyhandling
-
- return result;
-}
-
// accessing content
wxString st = str;
wxMacConvertNewlines10To13( &st );
wxMacEditHelper helper(m_textView);
-
+ NSEvent* formerEvent = m_lastKeyDownEvent;
+ m_lastKeyDownEvent = nil;
[m_textView insertText:wxCFStringRef( st , m_wxPeer->GetFont().GetEncoding() ).AsNSString()];
+ m_lastKeyDownEvent = formerEvent;
}
void wxNSTextViewControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack )
void wxNSTextFieldControl::WriteText(const wxString& str)
{
+ NSEvent* formerEvent = m_lastKeyDownEvent;
+ m_lastKeyDownEvent = nil;
NSText* editor = [m_textField currentEditor];
if ( editor )
{
SetStringValue( val ) ;
SetSelection( start + str.length() , start + str.length() ) ;
}
+ m_lastKeyDownEvent = formerEvent;
}
void wxNSTextFieldControl::controlAction(WXWidget WXUNUSED(slf),
void wxWidgetCocoaImpl::keyEvent(WX_NSEvent event, WXWidget slf, void *_cmd)
{
+ if ( [event type] == NSKeyDown )
+ m_lastKeyDownEvent = event;
if ( GetFocusedViewInWindow([slf window]) != slf || m_hasEditor || !DoHandleKeyEvent(event) )
{
wxOSX_EventHandlerPtr superimpl = (wxOSX_EventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
superimpl(slf, (SEL)_cmd, event);
}
+ m_lastKeyDownEvent = NULL;
}
void wxWidgetCocoaImpl::insertText(NSString* text, WXWidget slf, void *_cmd)
wxOSX_TextEventHandlerPtr superimpl = (wxOSX_TextEventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
superimpl(slf, (SEL)_cmd, text);
}
- m_lastKeyDownEvent = NULL;
}
// this will fire higher level events, like insertText, to help
// us handle EVT_CHAR, etc.
- if ( !m_hasEditor && [event type] == NSKeyDown)
+
+ if ( m_wxPeer->MacIsUserPane() && [event type] == NSKeyDown)
{
- m_lastKeyDownEvent = event;
if ( !result )
{
if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
result = true;
}
}
+
return result;
}