X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/261917904250fc47a5b89be3d799a2a4df80273c..414dfb5804fc568b26fec3f8a8ecc2f25addedfd:/src/cocoa/window.mm diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index f2b9e65341..630b14bd65 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -25,7 +25,6 @@ #import #import #import -#import #include @@ -121,6 +120,7 @@ void wxWindowCocoaHider::Cocoa_FrameChanged(void) [m_owner->GetNSViewForHiding() setFrame:[m_dummyNSView frame]]; } + #ifdef WXCOCOA_FILL_DUMMY_VIEW bool wxWindowCocoaHider::Cocoa_drawRect(const NSRect& rect) { @@ -481,6 +481,16 @@ void wxWindowCocoa::Cocoa_FrameChanged(void) GetEventHandler()->ProcessEvent(event); } +bool wxWindowCocoa::Cocoa_resetCursorRects() +{ + if(!m_cursor.GetNSCursor()) + return false; + + [GetNSView() addCursorRect: [GetNSView() visibleRect] cursor: m_cursor.GetNSCursor()]; + + return true; +} + bool wxWindow::Close(bool force) { // The only reason this function exists is that it is virtual and @@ -600,22 +610,20 @@ void wxWindowCocoa::DoSetSize(int x, int y, int width, int height, int sizeFlags DoMoveWindow(x,y,width,height); } -//We should really get rid of wxToolTip :) -IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject) +#if wxUSE_TOOLTIPS void wxWindowCocoa::DoSetToolTip( wxToolTip *tip ) { wxWindowBase::DoSetToolTip(tip); - wxAutoNSAutoreleasePool pool; - if ( m_tooltip ) { m_tooltip->SetWindow((wxWindow *)this); - [GetNSView() setToolTip:wxNSStringWithWxString(m_tooltip->GetTip())]; } } +#endif + void wxWindowCocoa::DoMoveWindow(int x, int y, int width, int height) { wxAutoNSAutoreleasePool pool; @@ -687,6 +695,11 @@ WXWidget wxWindow::GetHandle() const return m_cocoaNSView; } +wxWindow* wxWindow::GetWxWindow() const +{ + return (wxWindow*) this; +} + void wxWindow::Refresh(bool eraseBack, const wxRect *rect) { [m_cocoaNSView setNeedsDisplay:YES]; @@ -694,7 +707,14 @@ void wxWindow::Refresh(bool eraseBack, const wxRect *rect) void wxWindow::SetFocus() { - // TODO +#ifdef __WXDEBUG__ + bool bOK = +#endif + [GetNSView() lockFocusIfCanDraw]; + + //Note that the normal lockFocus works on hidden and minimized windows + //and has no return value - which probably isn't what we want + wxASSERT(bOK); } void wxWindow::DoCaptureMouse() @@ -875,8 +895,12 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y) // Get the window with the focus wxWindow *wxWindowBase::DoFindFocus() { - // TODO - return NULL; + wxCocoaNSView *win = wxCocoaNSView::GetFromCocoa([NSView focusView]); + + if (!win) + return NULL; + + return win->GetWxWindow(); } /* static */ wxWindow *wxWindowBase::GetCapture()