bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame* parent, wxWindowID id, const wxString& title, const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name) { wxAuiMDIClientWindow* pClientWindow = parent->GetClientWindow(); wxASSERT_MSG((pClientWindow != NULL), wxT("Missing MDI client window.")); // see comment in constructor if (style & wxMINIMIZE) m_activate_on_create = false; wxSize cli_size = pClientWindow->GetClientSize(); // create the window off-screen to prevent flicker wxPanel::Create(pClientWindow, id, wxPoint(cli_size.x+1, cli_size.y+1), size, wxNO_BORDER, name); DoShow(false); SetMDIParentFrame(parent); // this is the currently active child parent->SetActiveChild(this); m_title = title; pClientWindow->AddPage(this, title, m_activate_on_create); pClientWindow->Refresh(); return true; }
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { SetName(name); SetWindowStyleFlag(style); m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); m_foregroundColour = *wxBLACK; m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); if ( id > -1 ) m_windowId = id; else m_windowId = (int)NewControlId(); wxMDIClientWindow* clientWindow = parent->GetClientWindow(); wxASSERT_MSG( (clientWindow != (wxWindow*) NULL), "Missing MDI client window."); if (clientWindow) clientWindow->AddChild(this); SetMDIParentFrame(parent); int width = size.x; int height = size.y; if (width == -1) width = 200; // TODO: give reasonable default if (height == -1) height = 200; // TODO: give reasonable default // We're deactivating the old child wxMDIChildFrame* oldActiveChild = parent->GetActiveChild(); if (oldActiveChild) { wxActivateEvent event(wxEVT_ACTIVATE, false, oldActiveChild->GetId()); event.SetEventObject( oldActiveChild ); oldActiveChild->GetEventHandler()->ProcessEvent(event); } // This is the currently active child parent->SetActiveChild((wxMDIChildFrame*) this); // This time we'll try a bog-standard bulletin board for // the 'frame'. A main window doesn't seem to work. m_mainWidget = (WXWidget) XtVaCreateWidget("client", xmBulletinBoardWidgetClass, (Widget) clientWindow->GetTopWidget(), XmNmarginWidth, 0, XmNmarginHeight, 0, /* XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, */ XmNresizePolicy, XmRESIZE_NONE, NULL); XtAddEventHandler((Widget) m_mainWidget, ExposureMask,False, wxUniversalRepaintProc, (XtPointer) this); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); ChangeBackgroundColour(); XtManageChild((Widget) m_mainWidget); SetTitle(title); clientWindow->AddPage(this, title, true); clientWindow->Refresh(); // Positions the toolbar and status bar -- but we don't have any. // PreResize(); wxModelessWindows.Append(this); return true; }