예제 #1
0
void CMainFrame::MakeNewView( CRuntimeClass* pViewRuntimeClass)
{
	CDocument* pDocument;
	CChildFrame *pActiveChild;

	pActiveChild =(CChildFrame *)this->MDIGetActive();

	pDocument = this->GetCurrentDoc ();
/*
	if (pActiveChild == NULL ||
	  (pDocument = pActiveChild->GetActiveDocument()) == NULL)
	{
		TRACE0("Warning: No active document for WindowNew command.\n");
		AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
		return;     // command failed
	}
*/
	// otherwise we have a new frame !
	CDocTemplate* pTemplate = pDocument->GetDocTemplate();
	ASSERT_VALID(pTemplate);
	CFrameWnd* pFrame = CreateNewGameViewFrame(pViewRuntimeClass, pTemplate, pDocument, pActiveChild);
	if (pFrame == NULL)
	{
		TRACE0("Warning: failed to create new frame.\n");
		return;     // command failed
	}

	pTemplate->InitialUpdateFrame(pFrame, pDocument);
}
예제 #2
0
HMENU COleIPFrameWnd::GetInPlaceMenu()
{
	// get active document associated with this frame window
	CDocument* pDoc = GetActiveDocument();
	ASSERT_VALID(pDoc);

	// get in-place menu from the doc template
	CDocTemplate* pTemplate = pDoc->GetDocTemplate();
	ASSERT_VALID(pTemplate);
	return pTemplate->m_hMenuInPlaceServer;
}
예제 #3
0
// @pymethod <o PyCDocTemplate>|PyCDocument|GetDocTemplate|Returns the template for the document.
PyObject *
ui_doc_get_template(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetDocTemplate);
	GUI_BGN_SAVE;
	CDocTemplate *ret = pDoc->GetDocTemplate();
	GUI_END_SAVE;
	// @pyseemfc CDocument|GetDocTemplate
	return ui_assoc_object::make(PyCDocTemplate::type, ret)->GetGoodRet();
}
예제 #4
0
void CMainFrame::OnWindowNew() 
{
	CDocument *pDoc;

	pDoc = this->GetCurrentDoc ();
	if (pDoc != NULL)
	{
		CChildFrame* pActiveChild;
	
		pActiveChild =(CChildFrame *)this->MDIGetActive();
		// Create a new frame !
		CDocTemplate* pTemplate = pDoc->GetDocTemplate();
		ASSERT_VALID(pTemplate);

		CFrameWnd* pFrame = pTemplate->CreateNewFrame(pDoc, pActiveChild);
		if (pFrame == NULL)
		{
			TRACE0("Warning: failed to create new frame.\n");
			return;     // command failed
		}

		pTemplate->InitialUpdateFrame(pFrame, pDoc);
	}
}
예제 #5
0
파일: winmdi.cpp 프로젝트: AeonAxan/mpc-hc
void CMDIFrameWnd::OnWindowNew()
{
	CMDIChildWnd* pActiveChild = MDIGetActive();
	CDocument* pDocument;
	if (pActiveChild == NULL ||
	  (pDocument = pActiveChild->GetActiveDocument()) == NULL)
	{
		TRACE(traceAppMsg, 0, "Warning: No active document for WindowNew command.\n");
		AfxMessageBox(AFX_IDP_COMMAND_FAILURE);
		return;     // command failed
	}

	// otherwise we have a new frame !
	CDocTemplate* pTemplate = pDocument->GetDocTemplate();
	ASSERT_VALID(pTemplate);
	CFrameWnd* pFrame = pTemplate->CreateNewFrame(pDocument, pActiveChild);
	if (pFrame == NULL)
	{
		TRACE(traceAppMsg, 0, "Warning: failed to create new frame.\n");
		return;     // command failed
	}

	pTemplate->InitialUpdateFrame(pFrame, pDocument);
}