X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bac6f2348d41e91d92baa2a35c19d35097547003..449110cd746414d5f77db428babe20b84720c73a:/src/cocoa/window.mm diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index 9adb78257a..3155c35f68 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -12,6 +12,8 @@ #include "wx/window.h" #include "wx/log.h" +#include "wx/cocoa/autorelease.h" + #import #import @@ -64,6 +66,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID winid, // Destructor wxWindow::~wxWindow() { + wxAutoNSAutoreleasePool pool; DestroyChildren(); if(m_parent) @@ -244,17 +247,19 @@ bool wxWindow::Close(bool force) bool wxWindow::Show(bool show) { + wxAutoNSAutoreleasePool pool; // If the window is marked as visible, then it shouldn't have a dummy view // If the window is marked hidden, then it should have a dummy view - wxASSERT_MSG( (m_isShown && !m_dummyNSView) || (!m_isShown && m_dummyNSView),"wxWindow: m_isShown does not agree with m_dummyNSView"); + // wxSpinCtrl (generic) abuses m_isShown, don't use it for any logic +// wxASSERT_MSG( (m_isShown && !m_dummyNSView) || (!m_isShown && m_dummyNSView),"wxWindow: m_isShown does not agree with m_dummyNSView"); // Return false if there isn't a window to show or hide if(!m_cocoaNSView) return false; - // Return false if the state isn't changing - if( show == m_isShown ) - return false; if(show) { + // If state isn't changing, return false + if(!m_dummyNSView) + return false; // replaceSubView releases m_dummyNSView, balancing the alloc [m_cocoaNSView retain]; [[m_dummyNSView superview] replaceSubview:m_dummyNSView with:m_cocoaNSView]; @@ -266,6 +271,9 @@ bool wxWindow::Show(bool show) } else { + // If state isn't changing, return false + if(m_dummyNSView) + return false; m_dummyNSView = [[NSView alloc] initWithFrame: [m_cocoaNSView frame]]; [m_dummyNSView retain]; // NOTE: replaceSubView will cause m_cocaNSView to be released @@ -485,6 +493,7 @@ void wxWindow::Clear() // Raise the window to the top of the Z order void wxWindow::Raise() { + wxAutoNSAutoreleasePool pool; NSView *nsview = m_dummyNSView?m_dummyNSView:m_cocoaNSView; NSView *superview = [nsview superview]; [nsview retain]; @@ -522,3 +531,15 @@ wxWindow *wxGetActiveWindow() return NULL; } +wxPoint wxGetMousePosition() +{ + // TODO + return wxDefaultPosition; +} + +wxWindow* wxFindWindowAtPointer(wxPoint& pt) +{ + pt = wxGetMousePosition(); + return NULL; +} +