/////////////////////////////////////////////////////////////////////////////
-// Name: cocoa/mdi.mm
+// Name: src/cocoa/mdi.mm
// Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
// Author: David Elliott
// Modified by:
// Created: 2003/09/08
// RCS-ID: $Id$
// Copyright: (c) 2003 David Elliott
-// Licence: wxWindows licence
+// Licence: wxWidgets licence
/////////////////////////////////////////////////////////////////////////////
#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"
// #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);
- (id)initWithWxMDIParentFrame: (wxMDIParentFrame *)mdiParent;
- (void)windowDidBecomeMain: (NSNotification *)notification;
@end // interface wxMDIParentFrameObserver : NSObject
+WX_DECLARE_GET_OBJC_CLASS(wxMDIParentFrameObserver,NSObject)
@implementation wxMDIParentFrameObserver : NSObject
- (id)init
{
- wxFAIL_MSG("[wxMDIParentFrameObserver -init] should never be called!");
+ wxFAIL_MSG(wxT("[wxMDIParentFrameObserver -init] should never be called!"));
m_mdiParent = NULL;
return self;
}
}
@end // implementation wxMDIParentFrameObserver : NSObject
+WX_IMPLEMENT_GET_OBJC_CLASS(wxMDIParentFrameObserver,NSObject)
// ========================================================================
// wxMDIParentFrame
{
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:)
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()
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
{
- m_clientWindow = new wxMDIClientWindow( this );
- return m_clientWindow;
+ return new wxMDIClientWindow( this );
}
void wxMDIParentFrame::ActivateNext()
void wxMDIParentFrame::CocoaDelegate_windowDidBecomeKey(void)
{
- wxLogDebug("wxMDIParentFrame=%p::CocoaDelegate_windowDidBecomeKey",this);
+ wxLogTrace(wxTRACE_COCOA,wxT("wxMDIParentFrame=%p::CocoaDelegate_windowDidBecomeKey"),this);
if(sm_cocoaDeactivateWindow && sm_cocoaDeactivateWindow==m_currentChild)
{
sm_cocoaDeactivateWindow = NULL;
void wxMDIParentFrame::CocoaDelegate_windowDidResignKey(void)
{
- wxLogDebug("wxMDIParentFrame=%p::CocoaDelegate_windowDidResignKey",this);
+ wxLogTrace(wxTRACE_COCOA,wxT("wxMDIParentFrame=%p::CocoaDelegate_windowDidResignKey"),this);
if(m_closed)
wxFrame::CocoaDelegate_windowDidResignKey();
else
}
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++)
void wxMDIChildFrame::CocoaDelegate_windowDidBecomeKey(void)
{
- wxLogDebug("wxMDIChildFrame=%p::CocoaDelegate_windowDidBecomeKey",this);
+ wxLogTrace(wxTRACE_COCOA,wxT("wxMDIChildFrame=%p::CocoaDelegate_windowDidBecomeKey"),this);
if(sm_cocoaDeactivateWindow && sm_cocoaDeactivateWindow==m_mdiParent)
{
sm_cocoaDeactivateWindow = NULL;
void wxMDIChildFrame::CocoaDelegate_windowDidResignKey(void)
{
- wxLogDebug("wxMDIChildFrame=%p::CocoaDelegate_windowDidResignKey",this);
+ wxLogTrace(wxTRACE_COCOA,wxT("wxMDIChildFrame=%p::CocoaDelegate_windowDidResignKey"),this);
sm_cocoaDeactivateWindow = this;
}
}
wxMDIClientWindow::wxMDIClientWindow(wxMDIParentFrame *parent, long style)
-: wxWindow(parent, -1)
+ :wxWindow(parent, wxID_ANY)
{
}
return false;
}
+#endif