X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a533f0504f8067182cad0c26cbba7074248c8c37..cbe067603829728da8852282e895f25b2bccf732:/src/osx/cocoa/window.mm diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 83a5e7f79a..a5148d5ee3 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -15,6 +15,7 @@ #include "wx/dcclient.h" #include "wx/nonownedwnd.h" #include "wx/log.h" + #include "wx/textctrl.h" #endif #ifdef __WXMAC__ @@ -31,6 +32,10 @@ #include "wx/dnd.h" #endif +#if wxUSE_TOOLTIPS + #include "wx/tooltip.h" +#endif + #include // Get the window with the focus @@ -879,7 +884,7 @@ unsigned int wxWidgetCocoaImpl::draggingUpdated(void* s, WXWidget WXUNUSED(slf), result = wxDragCopy; else if ( sourceDragMask & NSDragOperationMove ) result = wxDragMove; - + PasteboardRef pboardRef; PasteboardCreate((CFStringRef)[pboard name], &pboardRef); target->SetCurrentDragPasteboard(pboardRef); @@ -1123,6 +1128,18 @@ void wxWidgetCocoaImpl::controlDoubleAction( WXWidget WXUNUSED(slf), void *WXUNU { } +void wxWidgetCocoaImpl::controlTextDidChange() +{ + wxWindow* wxpeer = (wxWindow*)GetWXPeer(); + if ( wxpeer ) + { + wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId()); + event.SetEventObject( wxpeer ); + event.SetString( static_cast(wxpeer)->GetValue() ); + wxpeer->HandleWindowEvent( event ); + } +} + // #if OBJC_API_VERSION >= 2 @@ -1627,7 +1644,7 @@ bool wxWidgetCocoaImpl::HasFocus() const bool wxWidgetCocoaImpl::SetFocus() { - if ( [m_osxView canBecomeKeyView] == NO ) + if ( !CanFocus() ) return false; [[m_osxView window] makeFirstResponder: m_osxView] ; @@ -1877,6 +1894,18 @@ void wxWidgetCocoaImpl::SetFont(wxFont const& font, wxColour const&, long, bool) [m_osxView setFont: font.OSXGetNSFont()]; } +void wxWidgetCocoaImpl::SetToolTip(wxToolTip* tooltip) +{ + if (tooltip) + { + wxCFStringRef cf( tooltip->GetTip() , m_wxPeer->GetFont().GetEncoding() ); + [m_osxView setToolTip: cf.AsNSString()]; + } + else + [m_osxView setToolTip: nil]; + +} + void wxWidgetCocoaImpl::InstallEventHandler( WXWidget control ) { WXWidget c = control ? control : (WXWidget) m_osxView;