X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfea8e619a9ccc2f8e90c28120239d069fb7de22..9db177273906bb393b97b4a98f6a8b4d61e8f0e3:/src/osx/carbon/mdi.cpp diff --git a/src/osx/carbon/mdi.cpp b/src/osx/carbon/mdi.cpp index 3cd460be75..80f31dc379 100644 --- a/src/osx/carbon/mdi.cpp +++ b/src/osx/carbon/mdi.cpp @@ -34,10 +34,6 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) END_EVENT_TABLE() -BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) - EVT_SCROLL(wxMDIClientWindow::OnScroll) -END_EVENT_TABLE() - #define TRACE_MDI "mdi" static const int IDM_WINDOWTILEHOR = 4001; @@ -75,6 +71,8 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) #endif } #elif defined(wxOSX_USE_COCOA) + wxUnusedVar(inActivate); + wxUnusedVar(inWindowRef); // TODO: implement me! #endif } @@ -85,15 +83,12 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) void wxMDIParentFrame::Init() { - m_clientWindow = NULL; - m_currentChild = NULL; - m_windowMenu = (wxMenu*) NULL; m_parentFrameActive = true; m_shouldBeShown = false; } bool wxMDIParentFrame::Create(wxWindow *parent, - wxWindowID id, + wxWindowID winid, const wxString& title, const wxPoint& pos, const wxSize& size, @@ -104,7 +99,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent, // "Window" menu if ( style & wxFRAME_NO_WINDOW_MENU ) { - m_windowMenu = (wxMenu *)NULL; + m_windowMenu = NULL; style -= wxFRAME_NO_WINDOW_MENU ; } else // normal case: we have the window menu, so construct it @@ -119,14 +114,16 @@ bool wxMDIParentFrame::Create(wxWindow *parent, m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next")); } - if ( !wxFrame::Create( parent , id , title , pos , size , style , name ) ) + if ( !wxFrame::Create( parent , winid , title , pos , size , style , name ) ) return false; m_parentFrameActive = true; m_clientWindow = OnCreateClient(); + if ( !m_clientWindow || !m_clientWindow->CreateClient(this, style) ) + return false; - return m_clientWindow != NULL; + return true; } wxMDIParentFrame::~wxMDIParentFrame() @@ -135,8 +132,6 @@ wxMDIParentFrame::~wxMDIParentFrame() // already deleted by DestroyChildren() m_clientWindow = NULL ; - - delete m_windowMenu; } void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar) @@ -254,7 +249,9 @@ void wxMDIParentFrame::MacActivate(long timestamp, bool activating) else // schedule ourselves for deactivation { if (s_macDeactivateWindow) + { wxLogTrace(TRACE_MDI, wxT("window=%p SHOULD have been deactivated, oh well!"), s_macDeactivateWindow); + } wxLogTrace(TRACE_MDI, wxT("Scheduling delayed MDI Parent deactivation")); s_macDeactivateWindow = this; @@ -267,19 +264,6 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event) event.Skip(); } -// Returns the active MDI child window -wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const -{ - return m_currentChild ; -} - -// Create the client window class (don't Create the window, -// just return a new class) -wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() -{ - return new wxMDIClientWindow( this ); -} - // Responds to colour changes, and passes event on to children. void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event) { @@ -289,32 +273,6 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event) wxFrame::OnSysColourChanged(event); } -// MDI operations -void wxMDIParentFrame::Cascade() -{ - // TODO -} - -void wxMDIParentFrame::Tile(wxOrientation WXUNUSED(orient)) -{ - // TODO -} - -void wxMDIParentFrame::ArrangeIcons() -{ - // TODO -} - -void wxMDIParentFrame::ActivateNext() -{ - // TODO -} - -void wxMDIParentFrame::ActivatePrevious() -{ - // TODO -} - bool wxMDIParentFrame::ShouldBeVisible() const { for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); @@ -365,29 +323,27 @@ bool wxMDIParentFrame::Show( bool show ) // Child frame // ---------------------------------------------------------------------------- -wxMDIChildFrame::wxMDIChildFrame() -{ - Init() ; -} void wxMDIChildFrame::Init() { } bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, - wxWindowID id, + wxWindowID winid, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { + m_mdiParent = parent; + SetName(name); - if ( id == wxID_ANY ) - id = (int)NewControlId(); + if ( winid == wxID_ANY ) + winid = (int)NewControlId(); + + wxNonOwnedWindow::Create( parent, winid, pos , size , MacRemoveBordersFromStyle(style) , name ) ; - wxNonOwnedWindow::Create( parent, id, pos , size , MacRemoveBordersFromStyle(style) , name ) ; - SetTitle( title ); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); @@ -400,16 +356,11 @@ wxMDIChildFrame::~wxMDIChildFrame() DestroyChildren(); } -void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar) -{ - return wxFrame::SetMenuBar( menu_bar ) ; -} - void wxMDIChildFrame::MacActivate(long timestamp, bool activating) { wxLogTrace(TRACE_MDI, wxT("MDI child=%p MacActivate(0x%08lx,%s)"),this, timestamp, activating ? wxT("ACTIV") : wxT("deact")); - wxMDIParentFrame *mdiparent = wxDynamicCast(m_parent, wxMDIParentFrame); + wxMDIParentFrame *mdiparent = m_mdiParent; wxASSERT(mdiparent); if (activating) @@ -453,7 +404,9 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating) else // schedule ourselves for deactivation { if (s_macDeactivateWindow) + { wxLogTrace(TRACE_MDI, wxT("window=%p SHOULD have been deactivated, oh well!"), s_macDeactivateWindow); + } wxLogTrace(TRACE_MDI, wxT("Scheduling delayed deactivation")); s_macDeactivateWindow = this; @@ -462,29 +415,17 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating) } // MDI operations -void wxMDIChildFrame::Maximize() -{ - wxFrame::Maximize() ; -} - -void wxMDIChildFrame::Restore() -{ - wxFrame::Restore() ; -} - void wxMDIChildFrame::Activate() { - Raise (); + // The base class method calls Activate() so skip it to avoid infinite + // recursion and go directly to the real Raise() implementation. + wxFrame::Raise(); } //----------------------------------------------------------------------------- // wxMDIClientWindow //----------------------------------------------------------------------------- -wxMDIClientWindow::wxMDIClientWindow() -{ -} - wxMDIClientWindow::~wxMDIClientWindow() { DestroyChildren(); @@ -498,15 +439,9 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) return true; } -// Get size *available for subwindows* i.e. excluding menu bar. void wxMDIClientWindow::DoGetClientSize(int *x, int *y) const { wxDisplaySize( x , y ) ; } -// Explicitly call default scroll behaviour -void wxMDIClientWindow::OnScroll(wxScrollEvent& WXUNUSED(event)) -{ -} - #endif // wxUSE_MDI