]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/window.mm
use wxDIB class instead of duplicating DDB -> DIB conversion code once again (aaaargh...
[wxWidgets.git] / src / cocoa / window.mm
index 85b60e41a935ce1327a4662b0436d089ea658076..e877d7371bf415cd6d68eb2a9a27e96eb572fb9d 100644 (file)
@@ -87,9 +87,9 @@ void wxWindowCocoa::CocoaAddChild(wxWindowCocoa *child)
 
 void wxWindowCocoa::CocoaRemoveFromParent(void)
 {
-    wxASSERT(m_cocoaNSView);
     if(m_dummyNSView)
     {
+        wxASSERT(m_cocoaNSView);
         // balances the alloc
         [m_dummyNSView removeFromSuperview];
         // But since we also retained it ourselves
@@ -148,7 +148,6 @@ bool wxWindow::Show(bool show)
         // But since we also retained it ourselves
         [m_dummyNSView release];
         m_dummyNSView = nil;
-        return true;
     }
     else
     {
@@ -157,8 +156,9 @@ bool wxWindow::Show(bool show)
         // NOTE: replaceSubView will cause m_cocaNSView to be released
         [[m_cocoaNSView superview] replaceSubview:m_cocoaNSView with:m_dummyNSView];
         // m_coocaNSView is now only retained by us
-        return true;
     }
+    m_isShown = show;
+    return true;
 }
 
 void wxWindowCocoa::DoSetSize(int x, int y, int width, int height, int sizeFlags)
@@ -205,7 +205,8 @@ void wxWindowCocoa::DoMoveWindow(int x, int y, int width, int height)
 {
     wxLogDebug("wxWindow=%p::DoMoveWindow(%d,%d,%d,%d)",this,x,y,width,height);
 
-    NSView *superview = [m_cocoaNSView superview];
+    NSView *nsview = m_dummyNSView?m_dummyNSView:m_cocoaNSView;
+    NSView *superview = [nsview superview];
     wxCHECK_RET(superview,"NSView does not have a superview");
     NSRect parentRect = [superview frame];
 
@@ -229,11 +230,12 @@ void wxWindow::DoGetSize(int *w, int *h) const
 
 void wxWindow::DoGetPosition(int *x, int *y) const
 {
-    NSView *superview = [m_cocoaNSView superview];
+    NSView *nsview = m_dummyNSView?m_dummyNSView:m_cocoaNSView;
+    NSView *superview = [nsview superview];
     wxCHECK_RET(superview,"NSView does not have a superview");
     NSRect parentRect = [superview frame];
 
-    NSRect cocoaRect = [m_cocoaNSView frame];
+    NSRect cocoaRect = [nsview frame];
     if(x)
         *x=(int)cocoaRect.origin.x;
     if(y)