]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/mdi.mm
Move MinGW builds to another machine as td165 is down.
[wxWidgets.git] / src / cocoa / mdi.mm
index 40dfa87d6961013b87bd01d2fa812d0b844057d7..b1aa7c6b264add299e348b4ec459461df9e41e68 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        cocoa/mdi.mm
+// Name:        src/cocoa/mdi.mm
 // Purpose:     wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
 // Author:      David Elliott
 // Modified by:
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
+
+#if wxUSE_MDI
+
+#include "wx/mdi.h"
+
+#include "wx/cocoa/objc/objc_uniquifying.h"
+
 #ifndef WX_PRECOMP
     #include "wx/log.h"
-    #include "wx/mdi.h"
 #endif // WX_PRECOMP
 
 // #include "wx/cocoa/autorelease.h"
@@ -23,7 +29,7 @@
 // #import <AppKit/NSApplication.h>
 // #import <AppKit/NSView.h>
 
-#include <wx/listimpl.cpp>
+#include "wx/listimpl.cpp"
 WX_DEFINE_LIST(wxCocoaMDIChildFrameList);
 
 WX_DECLARE_HASH_MAP(int, wxMDIChildFrame*, wxIntegerHash, wxIntegerEqual, wxIntMDIChildFrameHashMap);
@@ -40,6 +46,7 @@ WX_DECLARE_HASH_MAP(int, wxMDIChildFrame*, wxIntegerHash, wxIntegerEqual, wxIntM
 - (id)initWithWxMDIParentFrame: (wxMDIParentFrame *)mdiParent;
 - (void)windowDidBecomeMain: (NSNotification *)notification;
 @end // interface wxMDIParentFrameObserver : NSObject
+WX_DECLARE_GET_OBJC_CLASS(wxMDIParentFrameObserver,NSObject)
 
 @implementation wxMDIParentFrameObserver : NSObject
 - (id)init
@@ -63,6 +70,7 @@ WX_DECLARE_HASH_MAP(int, wxMDIChildFrame*, wxIntegerHash, wxIntegerEqual, wxIntM
 }
 
 @end // implementation wxMDIParentFrameObserver : NSObject
+WX_IMPLEMENT_GET_OBJC_CLASS(wxMDIParentFrameObserver,NSObject)
 
 // ========================================================================
 // wxMDIParentFrame
@@ -75,7 +83,7 @@ void wxMDIParentFrame::Init()
 {
     m_clientWindow = NULL;
     m_currentChild = NULL;
-    m_observer = [[wxMDIParentFrameObserver alloc]
+    m_observer = [[WX_GET_OBJC_CLASS(wxMDIParentFrameObserver) alloc]
             initWithWxMDIParentFrame:this];
     [[NSNotificationCenter defaultCenter] addObserver:m_observer
             selector:@selector(windowDidBecomeMain:)
@@ -87,10 +95,12 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
         const wxPoint& pos, const wxSize& size,
         long style, const wxString& name)
 {
-    bool success = wxFrame::Create(parent,winid,title,pos,size,style,name);
-    if(success)
-        OnCreateClient();
-    return success;
+    if ( !wxFrame::Create(parent,winid,title,pos,size,style,name) )
+        return false;
+
+    m_clientWindow = OnCreateClient();
+
+    return m_clientWindow != NULL;
 }
 
 wxMDIParentFrame::~wxMDIParentFrame()
@@ -137,8 +147,7 @@ wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const
 
 wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
 {
-    m_clientWindow = new wxMDIClientWindow( this );
-    return m_clientWindow;
+    return new wxMDIClientWindow( this );
 }
 
 void wxMDIParentFrame::ActivateNext()
@@ -228,10 +237,10 @@ void wxMDIParentFrame::WindowDidBecomeMain(NSNotification *notification)
         }
         if(!hashmap.empty())
         {
-            int windowCount = 0;
+            NSInteger windowCount = 0;
             NSCountWindows(&windowCount);
             wxASSERT(windowCount>0);
-            int *windowList = new int[windowCount];
+            NSInteger *windowList = new NSInteger[windowCount];
             NSWindowList(windowCount, windowList);
             wxIntMDIChildFrameHashMap::iterator iter = hashmap.end();
             for(int i=0; i<windowCount && iter == hashmap.end(); i++)
@@ -320,7 +329,7 @@ wxMDIClientWindow::wxMDIClientWindow()
 }
 
 wxMDIClientWindow::wxMDIClientWindow(wxMDIParentFrame *parent, long style)
-:   wxWindow(parent, -1)
+                  :wxWindow(parent, wxID_ANY)
 {
 }
 
@@ -333,3 +342,4 @@ bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style)
     return false;
 }
 
+#endif