X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/59cf2e4999e9ae9bcdc2a3093dec4ec27b50df5b..d2e66707deb10dea6f92e3e4092f8a43ef942a5d:/src/cocoa/mdi.mm diff --git a/src/cocoa/mdi.mm b/src/cocoa/mdi.mm index ef279856ca..741c582dcb 100644 --- a/src/cocoa/mdi.mm +++ b/src/cocoa/mdi.mm @@ -6,7 +6,7 @@ // Created: 2003/09/08 // RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" @@ -15,6 +15,8 @@ #include "wx/mdi.h" +#include "wx/cocoa/objc/objc_uniquifying.h" + #ifndef WX_PRECOMP #include "wx/log.h" #endif // WX_PRECOMP @@ -44,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 @@ -67,6 +70,7 @@ WX_DECLARE_HASH_MAP(int, wxMDIChildFrame*, wxIntegerHash, wxIntegerEqual, wxIntM } @end // implementation wxMDIParentFrameObserver : NSObject +WX_IMPLEMENT_GET_OBJC_CLASS(wxMDIParentFrameObserver,NSObject) // ======================================================================== // wxMDIParentFrame @@ -79,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:) @@ -91,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() @@ -123,36 +129,12 @@ void wxMDIParentFrame::RemoveMDIChild(wxMDIChildFrame *child) SetActiveChild(NULL); } -wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const -{ - return m_currentChild; -} - void wxMDIParentFrame::SetActiveChild(wxMDIChildFrame *child) { m_currentChild = child; wxMenuBarManager::GetInstance()->UpdateMenuBar(); } -wxMDIClientWindow *wxMDIParentFrame::GetClientWindow() const -{ - return m_clientWindow; -} - -wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() -{ - m_clientWindow = new wxMDIClientWindow( this ); - return m_clientWindow; -} - -void wxMDIParentFrame::ActivateNext() -{ -} - -void wxMDIParentFrame::ActivatePrevious() -{ -} - wxMenuBar *wxMDIParentFrame::GetAppMenuBar(wxCocoaNSWindow *win) { if(m_currentChild && (win==this)) @@ -232,10 +214,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