X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f618020a15f1647a83aaeab1fe315f90497a9876..ff1b5f81af5dce8dac0c134f0e01adffc5334347:/src/motif/mdi.cpp diff --git a/src/motif/mdi.cpp b/src/motif/mdi.cpp index 4fa16b4cfe..87a201a0e2 100644 --- a/src/motif/mdi.cpp +++ b/src/motif/mdi.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "mdi.h" #endif @@ -21,6 +21,7 @@ #include "wx/mdi.h" #include "wx/menu.h" #include "wx/settings.h" +#include "wx/icon.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -390,7 +391,6 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE, wxUniversalRepaintProc, (XtPointer) this); - SetCanAddEventHandler(TRUE); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); ChangeBackgroundColour(); @@ -425,8 +425,15 @@ wxMDIChildFrame::~wxMDIChildFrame() wxMDIClientWindow* clientWindow = parentFrame->GetClientWindow(); // Remove page if still there - if (clientWindow->RemovePage(this)) - clientWindow->Refresh(); + { + int i = clientWindow->FindPage(this); + + if (i != -1) + { + clientWindow->RemovePage(i); + clientWindow->Refresh(); + } + } // Set the selection to the first remaining page if (clientWindow->GetPageCount() > 0) @@ -509,7 +516,7 @@ void wxMDIChildFrame::DoGetPosition(int *x, int *y) const bool wxMDIChildFrame::Show(bool show) { - m_visibleStatus = show; /* show-&-hide fix */ + SetVisibleStatus( show ); return wxWindow::Show(show); } @@ -543,11 +550,16 @@ void wxMDIChildFrame::SetIcons(const wxIconBundle& icons) void wxMDIChildFrame::SetTitle(const wxString& title) { - m_title = title; + wxTopLevelWindow::SetTitle( title ); wxMDIClientWindow* clientWindow = GetMDIParentFrame()->GetClientWindow(); - int pageNo = clientWindow->FindPagePosition(this); - if (pageNo > -1) - clientWindow->SetPageText(pageNo, title); + + // Remove page if still there + { + int i = clientWindow->FindPage(this); + + if (i != -1) + clientWindow->SetPageText(i, title); + } } // MDI operations @@ -633,17 +645,24 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) if (success) { wxFont font(10, wxSWISS, wxNORMAL, wxNORMAL); - wxFont selFont(10, wxSWISS, wxNORMAL, wxBOLD); - GetTabView()->SetTabFont(font); - GetTabView()->SetSelectedTabFont(selFont); - GetTabView()->SetTabSize(120, 18); - GetTabView()->SetTabSelectionHeight(20); + SetFont(font); return TRUE; } else return FALSE; } +int wxMDIClientWindow::FindPage(const wxNotebookPage* page) +{ + for (int i = GetPageCount() - 1; i >= 0; --i) + { + if (GetPage(i) == page) + return i; + } + + return -1; +} + void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) { wxWindow::DoSetSize(x, y, width, height, sizeFlags);