X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd05bf23f6aec29f60a793f3ca4dfe336661fca1..1cd9779fce63b081d875de7a901c8eb6120d0b8a:/src/aui/tabmdi.cpp?ds=sidebyside diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index d57da77f66..71f53429d4 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: src/generic/mdig.cpp +// Name: src/aui/tabmdi.cpp // Purpose: Generic MDI (Multiple Document Interface) classes // Author: Hans Van Leemputten // Modified by: Benjamin I. Williams / Kirix Corporation @@ -24,6 +24,7 @@ #pragma hdrstop #endif +#if wxUSE_AUI #if wxUSE_MDI #include "wx/aui/tabmdi.h" @@ -33,6 +34,7 @@ #include "wx/menu.h" #include "wx/intl.h" #include "wx/log.h" + #include "wx/settings.h" #endif //WX_PRECOMP #include "wx/stockitem.h" @@ -131,14 +133,14 @@ void wxTabMDIParentFrame::SetWindowMenu(wxMenu* pMenu) } } -void wxTabMDIParentFrame::SetMenuBar(wxMenuBar *pMenuBar) +void wxTabMDIParentFrame::SetMenuBar(wxMenuBar* pMenuBar) { // Remove the Window menu from the old menu bar RemoveWindowMenu(GetMenuBar()); - + // Add the Window menu to the new menu bar. AddWindowMenu(pMenuBar); - + wxFrame::SetMenuBar(pMenuBar); m_pMyMenuBar = GetMenuBar(); } @@ -153,7 +155,7 @@ void wxTabMDIParentFrame::SetChildMenuBar(wxTabMDIChildFrame* pChild) SetMenuBar(m_pMyMenuBar); // Make sure we know our menu bar is in use - m_pMyMenuBar = NULL; + //m_pMyMenuBar = NULL; } else { @@ -229,7 +231,7 @@ wxTabMDIClientWindow *wxTabMDIParentFrame::OnCreateClient() void wxTabMDIParentFrame::ActivateNext() { - if (m_pClientWindow && m_pClientWindow->GetSelection() != -1) + if (m_pClientWindow && m_pClientWindow->GetSelection() != wxNOT_FOUND) { size_t active = m_pClientWindow->GetSelection() + 1; if (active >= m_pClientWindow->GetPageCount()) @@ -241,7 +243,7 @@ void wxTabMDIParentFrame::ActivateNext() void wxTabMDIParentFrame::ActivatePrevious() { - if (m_pClientWindow && m_pClientWindow->GetSelection() != -1) + if (m_pClientWindow && m_pClientWindow->GetSelection() != wxNOT_FOUND) { int active = m_pClientWindow->GetSelection() - 1; if (active < 0) @@ -281,7 +283,7 @@ void wxTabMDIParentFrame::AddWindowMenu(wxMenuBar *pMenuBar) { if (pMenuBar && m_pWindowMenu) { - int pos = pMenuBar->FindMenu(wxGetStockLabel(wxID_HELP,false)); + int pos = pMenuBar->FindMenu(wxGetStockLabel(wxID_HELP,wxSTOCK_NOFLAGS)); if (pos == wxNOT_FOUND) pMenuBar->Append(m_pWindowMenu, _("&Window")); else @@ -394,10 +396,10 @@ bool wxTabMDIChildFrame::Destroy() { wxTabMDIParentFrame* pParentFrame = GetMDIParentFrame(); wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame")); - + wxTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow(); wxASSERT_MSG(pClientWindow, wxT("Missing MDI Client Window")); - + bool bActive = false; if (pParentFrame->GetActiveChild() == this) { @@ -405,66 +407,17 @@ bool wxTabMDIChildFrame::Destroy() pParentFrame->SetChildMenuBar(NULL); bActive = true; } - + size_t pos, page_count = pClientWindow->GetPageCount(); for (pos = 0; pos < page_count; pos++) { if (pClientWindow->GetPage(pos) == this) return pClientWindow->DeletePage(pos); } - + return false; } -/* - wxTabMDIParentFrame* pParentFrame = GetMDIParentFrame(); - wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame")); - - bool bActive = false; - if (pParentFrame->GetActiveChild() == this) - { - pParentFrame->SetActiveChild(NULL); - pParentFrame->SetChildMenuBar(NULL); - bActive = true; - } - - wxTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow(); - - // remove page if it is still there - size_t pos; - for (pos = 0; pos < pClientWindow->GetPageCount(); pos++) - { - if (pClientWindow->GetPage(pos) == this) - { - if (pClientWindow->RemovePage(pos)) - pClientWindow->Refresh(); - break; - } - } - - if (bActive) - { - // Set the new selection to the a remaining page - if (pos < pClientWindow->GetPageCount()) - { - pClientWindow->SetSelection(pos); - } - else - { - if (pClientWindow->GetPageCount() >= 1) - pClientWindow->SetSelection(pClientWindow->GetPageCount() - 1); - } - } - - // delete the child frame with pending delete, as is - // customary with frame windows - if (!wxPendingDelete.Member(this)) - wxPendingDelete.Append(this); - - return true; -*/ - - #if wxUSE_MENUS void wxTabMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar) { @@ -594,9 +547,14 @@ void wxTabMDIChildFrame::DoShow(bool show) wxWindow::Show(show); } -void wxTabMDIChildFrame::DoSetSize(int x, int y, int width, int height, int WXUNUSED(sizeFlags)) +void wxTabMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) { m_mdi_newrect = wxRect(x, y, width, height); +#ifdef __WXGTK__ + wxPanel::DoSetSize(x,y,width, height, sizeFlags); +#else + wxUnusedVar(sizeFlags); +#endif } void wxTabMDIChildFrame::DoMoveWindow(int x, int y, int width, int height) @@ -622,7 +580,7 @@ void wxTabMDIChildFrame::ApplyMDIChildFrameRect() IMPLEMENT_DYNAMIC_CLASS(wxTabMDIClientWindow, wxAuiMultiNotebook) BEGIN_EVENT_TABLE(wxTabMDIClientWindow, wxAuiMultiNotebook) - EVT_AUINOTEBOOK_PAGE_CHANGED(-1, wxTabMDIClientWindow::OnPageChanged) + EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxTabMDIClientWindow::OnPageChanged) EVT_SIZE(wxTabMDIClientWindow::OnSize) END_EVENT_TABLE() @@ -645,19 +603,19 @@ bool wxTabMDIClientWindow::CreateClient(wxTabMDIParentFrame* parent, long style) SetWindowStyleFlag(style); if (!wxAuiMultiNotebook::Create(parent, - -1, + wxID_ANY, wxPoint(0,0), wxSize(100, 100), wxNO_BORDER)) { return false; } - + wxColour bkcolour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); SetBackgroundColour(bkcolour); - + m_mgr.GetArtProvider()->SetColour(wxAUI_ART_BACKGROUND_COLOUR, bkcolour); - + return true; } @@ -671,7 +629,7 @@ void wxTabMDIClientWindow::PageChanged(int old_selection, int new_selection) // don't do anything if the page doesn't actually change if (old_selection == new_selection) return; - + // don't do anything if the new page is already active if (new_selection != -1) { @@ -685,7 +643,7 @@ void wxTabMDIClientWindow::PageChanged(int old_selection, int new_selection) { wxTabMDIChildFrame* old_child = (wxTabMDIChildFrame*)GetPage(old_selection); wxASSERT_MSG(old_child, wxT("wxTabMDIClientWindow::PageChanged - null page pointer")); - + wxActivateEvent event(wxEVT_ACTIVATE, false, old_child->GetId()); event.SetEventObject(old_child); old_child->GetEventHandler()->ProcessEvent(event); @@ -696,7 +654,7 @@ void wxTabMDIClientWindow::PageChanged(int old_selection, int new_selection) { wxTabMDIChildFrame* active_child = (wxTabMDIChildFrame*)GetPage(new_selection); wxASSERT_MSG(active_child, wxT("wxTabMDIClientWindow::PageChanged - null page pointer")); - + wxActivateEvent event(wxEVT_ACTIVATE, true, active_child->GetId()); event.SetEventObject(active_child); active_child->GetEventHandler()->ProcessEvent(event); @@ -716,11 +674,12 @@ void wxTabMDIClientWindow::OnPageChanged(wxAuiNotebookEvent& evt) } void wxTabMDIClientWindow::OnSize(wxSizeEvent& evt) -{ +{ wxAuiMultiNotebook::OnSize(evt); for (size_t pos = 0; pos < GetPageCount(); pos++) ((wxTabMDIChildFrame *)GetPage(pos))->ApplyMDIChildFrameRect(); } +#endif //wxUSE_AUI #endif // wxUSE_MDI