当前位置: 首页>>代码示例>>C++>>正文


C++ CDocument::GetTitle方法代码示例

本文整理汇总了C++中CDocument::GetTitle方法的典型用法代码示例。如果您正苦于以下问题:C++ CDocument::GetTitle方法的具体用法?C++ CDocument::GetTitle怎么用?C++ CDocument::GetTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDocument的用法示例。


在下文中一共展示了CDocument::GetTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnFileNew

void CFileView::OnFileNew()
{
	CMultiDocTemplate* pUIDocTemplate = theApp.GetUIDocTemplate();
	CDocument* pDoc = pUIDocTemplate->OpenDocumentFile(NULL);
	CString strFilePath = CGlobalVariable::m_strProjectPath + pDoc->GetTitle() + _T(".xml");
	pDoc->DoSave(strFilePath);
	HTREEITEM hSelectedItem = m_wndFileView.GetSelectedItem();
	DWORD dwInfo = m_wndFileView.GetItemData(hSelectedItem);
	HTREEITEM hParent = (dwInfo != INFO_FILE) ? hSelectedItem : m_wndFileView.GetParentItem(hSelectedItem);
	HTREEITEM hNewItem = m_wndFileView.InsertItem(pDoc->GetTitle(), 2, 2, hParent);
	m_wndFileView.SetItemData(hNewItem, INFO_FILE);
	m_wndFileView.Expand(hParent, TVE_EXPAND);
}
开发者ID:DayDayUpCQ,项目名称:misc,代码行数:13,代码来源:FileView.cpp

示例2: OnUpdateFrameTitle

void CMDIFrameWnd::OnUpdateFrameTitle(BOOL bAddToTitle)
{
	if ((GetStyle() & FWS_ADDTOTITLE) == 0)
		return;     // leave it alone!

#ifndef _AFX_NO_OLE_SUPPORT
	// allow hook to set the title (used for OLE support)
	if (m_pNotifyHook != NULL && m_pNotifyHook->OnUpdateFrameTitle())
		return;
#endif

	CMDIChildWnd* pActiveChild = NULL;
	CDocument* pDocument = GetActiveDocument();
	if (bAddToTitle &&
	  (pActiveChild = MDIGetActive()) != NULL &&
	  (pActiveChild->GetStyle() & WS_MAXIMIZE) == 0 &&
	  (pDocument != NULL ||
	   (pDocument = pActiveChild->GetActiveDocument()) != NULL))
		UpdateFrameTitleForDocument(pDocument->GetTitle());
	else
	{
		LPCTSTR lpstrTitle = NULL;
		CString strTitle;

		if (pActiveChild != NULL &&
			(pActiveChild->GetStyle() & WS_MAXIMIZE) == 0)
		{
			strTitle = pActiveChild->GetTitle();
			if (!strTitle.IsEmpty())
				lpstrTitle = strTitle;
		}
		UpdateFrameTitleForDocument(lpstrTitle);
	}
}
开发者ID:AeonAxan,项目名称:mpc-hc,代码行数:34,代码来源:winmdi.cpp

示例3: MakeWave

bool CMainFrame::MakeWave(const WAVEGEN_PARMS& Parms)
{
	POSITION	pos = theApp.GetFirstDocTemplatePosition();
	CDocTemplate	*pTpl = theApp.GetNextDocTemplate(pos);
	CWaveShopDoc	*pDoc = DYNAMIC_DOWNCAST(CWaveShopDoc, pTpl->CreateNewDocument());
	if (pDoc == NULL)
		return(FALSE);
	bool	retc, canceled;
	{
		CProgressDlg	ProgDlg;
		if (!ProgDlg.Create())	// create progress dialog
			AfxThrowResourceException();
		ProgDlg.SetWindowText(LDS(IDS_MAIN_GENERATING_AUDIO));
		retc = CWaveGenDlg::MakeWave(Parms, pDoc->m_Wave, &ProgDlg);
		canceled = ProgDlg.Canceled();
	}	// destroy progress dialog
	if (!retc) {	// if generation failed
		if (!canceled)	// if user canceled
			AfxMessageBox(IDS_MAIN_CANT_MAKE_WAVE);
		return(FALSE);
	}
	CDocument	*pEmptyDoc = pTpl->OpenDocumentFile(NULL);	// create new view
	if (pEmptyDoc == NULL || m_View == NULL)
		return(FALSE);
	CString	title = pEmptyDoc->GetTitle();
	pEmptyDoc->RemoveView(m_View);	// remove empty document from view
	pDoc->SetTitle(title);	// copy empty document's title to generated document
	pDoc->AddView(m_View);	// add generated document to view
	m_View->OnInitialUpdate();
	OnActivateView(m_View);
	// view is still linked to empty document's undo manager; must relink
	m_View->SetUndoManager(&pDoc->m_UndoMgr);	// link view to undo manager
	pDoc->m_UndoMgr.SetRoot(m_View);	// link undo manager to view
	return(TRUE);
}
开发者ID:victimofleisure,项目名称:WaveShop,代码行数:35,代码来源:MainFrm.cpp

示例4: OnGetTabToolTip

LRESULT CMainFrame::OnGetTabToolTip(WPARAM /*wp*/, LPARAM lp)
{
	CMFCTabToolTipInfo* pInfo = (CMFCTabToolTipInfo*) lp;
	ASSERT(pInfo != NULL);
	if (!pInfo)
	{
		return 0;
	}

	ASSERT_VALID(pInfo->m_pTabWnd);

	if (!pInfo->m_pTabWnd->IsMDITab())
	{
		return 0;
	}

	CFrameWnd* pFrame = DYNAMIC_DOWNCAST(CFrameWnd, pInfo->m_pTabWnd->GetTabWnd(pInfo->m_nTabIndex));
	if (pFrame == NULL)
	{
		return 0;
	}

	CDocument* pDoc = pFrame->GetActiveDocument();
	if (pDoc == NULL)
	{
		return 0;
	}

	pInfo->m_strText = pDoc->GetPathName();
	if(pInfo->m_strText.IsEmpty())
		pInfo->m_strText=pDoc->GetTitle();

	return 0;
}
开发者ID:ddcatgg,项目名称:duilib,代码行数:34,代码来源:MainFrm.cpp

示例5: OnUpdateFrameTitle

void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
//----------------------------------------------------
{
    // update our parent window first
    GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle);

    if ((GetStyle() & FWS_ADDTOTITLE) == 0) {
        return;     // leave child window alone!
    }

    CDocument* pDocument = GetActiveDocument();
    if (bAddToTitle) {
        TCHAR szText[256+_MAX_PATH];
        if (pDocument == NULL) {
            lstrcpy(szText, m_strTitle);
        } else {
            lstrcpy(szText, pDocument->GetTitle());
            if (pDocument->IsModified()) lstrcat(szText, "*");
        }
        if (m_nWindow > 0) {
            wsprintf(szText + lstrlen(szText), _T(":%d"), m_nWindow);
        }

        // set title if changed, but don't remove completely
        AfxSetWindowText(m_hWnd, szText);
    }
}
开发者ID:aidush,项目名称:openmpt,代码行数:27,代码来源:Childfrm.cpp

示例6: OnUpdateFrameTitle

void CMDIChildWnd::OnUpdateFrameTitle( BOOL bAddToTitle )
/*******************************************************/
{
    UNUSED_ALWAYS( bAddToTitle );

    CDocument *pDoc = GetActiveDocument();
    if( pDoc != NULL ) {
        if( m_nWindow == 0 ) {
            ::SetWindowText( m_hWnd, pDoc->GetTitle() );
        } else {
            TCHAR szTitleBarText[256];
            _sntprintf( szTitleBarText, 255, _T("%s : %d"),
                        (LPCTSTR)pDoc->GetTitle(), m_nWindow );
            ::SetWindowText( m_hWnd, szTitleBarText );
        }
    } else {
        ::SetWindowText( m_hWnd, NULL );
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:19,代码来源:mdichild.cpp

示例7: PyWinObject_FromTCHAR

// @pymethod string|PyCDocument|GetTitle|Returns the title of the current document.
// This will often be the file name portion of the path name.
PyObject *
ui_doc_get_title(PyObject *self, PyObject *args)
{
	CDocument *pDoc;
	if (!(pDoc=PyCDocument::GetDoc(self)))
		return NULL;
	CHECK_NO_ARGS2(args,GetTitle);
	GUI_BGN_SAVE;
	CString path = pDoc->GetTitle(); // @pyseemfc CDocument|GetTitle
	GUI_END_SAVE;
	return PyWinObject_FromTCHAR(path);
}
开发者ID:malrsrch,项目名称:pywin32,代码行数:14,代码来源:win32doc.cpp

示例8: SetTitle

void OleDocRoot::SetTitle(LPCTSTR lpszTitle)
  {
  CString s(lpszTitle);
  CDocTemplate* pTempl = GetDocTemplate();
  if (pTempl)
    {
    flag Found = True;
    while (Found)
      {
      Found = False;
      POSITION Pos = pTempl->GetFirstDocPosition();
      while (Pos && !Found)
        {
        CDocument * pDoc = pTempl->GetNextDoc(Pos);
        if (pDoc!=this)
          {
          CString Title = pDoc->GetTitle();
          if (Title.GetLength()==s.GetLength() && _stricmp((const char*)s, (const char*)Title)==0)
            Found = True;
          }
        }
      if (Found)
        {
        CString Ext = "";
        int DotPos = s.ReverseFind('.');
        if (DotPos>=0)
          {
          Ext = s.Mid(DotPos, 256);
          s = s.Left(DotPos);
          }
        int _Pos = s.ReverseFind('_');
        if (_Pos>=0)
          {
          CString ss = s.Mid(_Pos+1, 256);
          s = s.Left(_Pos+1);
          if (ss.GetLength()>0)
            {
            char Buff[32];
            sprintf(Buff, "%d", atoi((const char*)ss) + 1);
            s += Buff;
            }
          else
            s += "1";
          }
        else
          s += "_1";
        s += Ext;
        }
      }
    }
  COleLinkingDoc::SetTitle((const char*)s);
  }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:52,代码来源:Docroot.cpp

示例9: GetChildWndText

CString CXTPMDIWndTab::GetChildWndText(HWND hWnd) const
{
	// Check to see if the user has defined a label for the tab first.
	CString strTitle;
	if (m_mapTabLabels.Lookup(hWnd, strTitle))
	{
		return strTitle;
	}

	// Get a pointer to the frame window.
	CMDIChildWnd* pChildFrame = (CMDIChildWnd*)CWnd::FromHandle(hWnd);
	if (!::IsWindow(pChildFrame->GetSafeHwnd()))
	{
		return _T("");
	}

	// Get the window text for the frame and use it for the tab label.
	pChildFrame->GetWindowText(strTitle);

	// If the string is empty the document's title.
	if (strTitle.IsEmpty())
	{
		CWnd* pChildWnd = pChildFrame->GetWindow(GW_CHILD);
		while (pChildWnd)
		{
			if (pChildWnd->IsKindOf(RUNTIME_CLASS(CView)))
			{
				// Get a pointer to the view's document.
				CDocument* pDoc = ((CView*)pChildWnd)->GetDocument();
				if (pDoc == NULL)
				{
					return _T("");
				}

				// Set the return string value
				strTitle = pDoc->GetTitle();

				// Reset the frames title
				pChildFrame->SetWindowText(strTitle);

				// Return the document title.
				return strTitle;
			}
			pChildWnd = pChildWnd->GetWindow(GW_HWNDNEXT);
		}
	}

	// Return the MDI frame window's title.
	return strTitle;
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:50,代码来源:XTPMDIWndTab.cpp

示例10: OnUpdateFrameTitle

void CFrameWnd::OnUpdateFrameTitle( BOOL bAddToTitle )
/****************************************************/
{
    if( bAddToTitle ) {
        CDocument *pDoc = GetActiveDocument();
        if( pDoc != NULL ) {
            UpdateFrameTitleForDocument( pDoc->GetTitle() );
        } else {
            UpdateFrameTitleForDocument( NULL );
        }
    } else {
        UpdateFrameTitleForDocument( NULL );
    }
}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:14,代码来源:framewnd.cpp

示例11: OnInitDialog

BOOL CBackStagePageInfo::OnInitDialog() 
{
	LFDialog::OnInitDialog();

	LFStaticLayout* pLayout = (LFStaticLayout*)GetLayout();
	ASSERT_VALID(pLayout);
	
	pLayout->AddAnchor(IDC_PATH_LABEL, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
	
	pLayout->AddAnchor(IDC_SEPARATOR_1, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
	pLayout->AddAnchor(IDC_TEXT1, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
	
	pLayout->AddAnchor(IDC_SEPARATOR_2, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
	pLayout->AddAnchor(IDC_TEXT2, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
	
	pLayout->AddAnchor(IDC_SEPARATOR_3, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
	pLayout->AddAnchor(IDC_TEXT3, LFStaticLayout::e_MoveTypeNone, LFStaticLayout::e_SizeTypeHorz);
	
	pLayout->AddAnchor(IDC_SEPARATOR_4, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeVert);
	
	pLayout->AddAnchor(IDC_INFO_LABEL, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);
	pLayout->AddAnchor(IDC_SEPARATOR_5, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);
	pLayout->AddAnchor(IDC_PREVIEW, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);
	pLayout->AddAnchor(IDC_TEXT4, LFStaticLayout::e_MoveTypeHorz, LFStaticLayout::e_SizeTypeNone);

	CFrameWnd* pMainFrame = (CFrameWnd*)AfxGetMainWnd();
	
	CFrameWnd* pFrame = pMainFrame->GetActiveFrame();
	if (pFrame != NULL)
	{
		CDocument* pDoc = pFrame->GetActiveDocument();
		if (pDoc != NULL)
		{
			m_strDocName = pDoc->GetTitle();
			m_strPath = pDoc->GetPathName();
		}
	}

	PreparePreviewBitmap();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:jefferyliangmh,项目名称:AutoWatch,代码行数:43,代码来源:BackStagePageInfo.cpp

示例12: OnUpdateFrameTitle

void CChildFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
	GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle);

	if ( (GetStyle() & FWS_ADDTOTITLE) == 0) return;

	if (bAddToTitle)
	{
		CDocument* pDoc = GetActiveDocument();
		CString csText;
		if (pDoc == NULL) csText = m_strTitle;
		else {
			csText = pDoc->GetTitle();
		}

		if (m_nWindow > 0) csText.Format(_T("%s: %d"), csText, m_nWindow);
		if (pDoc->IsModified()) csText += " *";

		AfxSetWindowText(m_hWnd, csText);
	}
}
开发者ID:soloveyhappy,项目名称:tiny,代码行数:21,代码来源:ChildFrm.cpp

示例13: _FillMDIWindowList

void CExtMdiWindowsListDlg::_FillMDIWindowList()
{
	m_ListWindows.SetRedraw(FALSE);
	m_ListWindows.ResetContent();
	
	CMDIChildWnd* pActiveChild = (CMDIChildWnd*)m_pMDIFrameWnd->MDIGetActive();
	if (pActiveChild != NULL) 
	{
		CMDIChildWnd* pChildFrame = (CMDIChildWnd*)pActiveChild->GetWindow(GW_HWNDLAST);
		while (pChildFrame != NULL) 
		{
			HWND hChildFrame = pChildFrame->GetSafeHwnd();
			CString strWindowText;
			pChildFrame->GetWindowText( strWindowText );
			if( strWindowText.IsEmpty() )
			{
				CWnd* pMDIChildWnd = pChildFrame->GetWindow(GW_CHILD);
				while( pMDIChildWnd )
				{
					if( pMDIChildWnd->IsKindOf(RUNTIME_CLASS(CView)) ) 
					{
						CDocument* pDocument = ((CView*)pMDIChildWnd)->GetDocument();
						if (pDocument == NULL)
							strWindowText = _T("");
						strWindowText = pDocument->GetTitle();
						pChildFrame->SetWindowText( strWindowText );
					} // if( pMDIChildWnd->IsKindOf(RUNTIME_CLASS(CView)) ) 
					pMDIChildWnd = pMDIChildWnd->GetWindow(GW_HWNDNEXT);
				} // while( pMDIChildWnd )
			} // if( strWindowText.IsEmpty() )
			int iIndex = m_ListWindows.AddString(strWindowText);
			m_ListWindows.SetItemData(iIndex, (DWORD)hChildFrame);
			
			pChildFrame = (CMDIChildWnd*)pChildFrame->GetWindow(GW_HWNDPREV);
		} // while (pChildFrame != NULL) 
	} // if (pActiveChild != NULL) 

	m_ListWindows.SetRedraw(TRUE);
}
开发者ID:ngphloc,项目名称:agmagic,代码行数:39,代码来源:ExtMdiWindowsListDlg.cpp

示例14: OnViewPrediction

void CMainFrame::OnViewPrediction()
{
	// TODO: Add your command handler code here
	CDocument* pDoc;
	CView* pView;
	CCreateContext context;
	CRect rect;
	pView=(CView*)m_splitter.GetPane(0,0);
	pView->GetWindowRect(rect);
	if(!pView)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc=pView->GetDocument();
	CString title=pDoc->GetTitle();
	if(!pDoc)
	{
		AfxMessageBox("Unexpected error occurs");
		return;
	}
	pDoc->m_bAutoDelete=false;
	m_splitter.GetPane(0,0)->DestroyWindow();
	pDoc->m_bAutoDelete=true;
	context.m_pNewViewClass=RUNTIME_CLASS(CPredView);
	context.m_pCurrentDoc=pDoc;
	context.m_pLastView=NULL;
	context.m_pNewDocTemplate=NULL;
	context.m_pCurrentFrame=NULL;
	m_splitter.CreateView(0,0,RUNTIME_CLASS(CPredView),CSize(rect.Width(),rect.Height()),&context);
	((CView*)m_splitter.GetPane(0,0))->OnInitialUpdate();// it is important to call initial update before create a view expecially a CScrollView
	m_splitter.RecalcLayout();
	m_splitter.GetPane(0,0)->SendMessage(WM_PAINT);
	SetActiveView((CScrollView*)m_splitter.GetPane(0,0));
	pDoc->SetTitle(title);
	((CFCCDoc*)pDoc)->MessageCenter(IDS_MESSAGE_MAKEPREDICTION);
	

}
开发者ID:chao-ma,项目名称:LiCABEDS,代码行数:39,代码来源:MainFrm.cpp

示例15: GetFile

// Returns the name of the currently opened file, including extension (if saved).
CString CTemplateFormater::GetFile(void)
{
	// Use the generic view class to make this class as portable as possible
	CView* pView = NULL;

	CMDIFrameWnd* pFrame = reinterpret_cast<CMDIFrameWnd*>(AfxGetApp()->m_pMainWnd);
	
	// Get the active MDI child window.
	CMDIChildWnd* pChild = 
		reinterpret_cast<CMDIChildWnd*>(pFrame->GetActiveFrame());		
	// or CMDIChildWnd *pChild = pFrame->MDIGetActive();
	
	// Get the active view attached to the active MDI child window.
	pView = reinterpret_cast<CView*>(pChild->GetActiveView());		

	ASSERT(pView != NULL);
	// If at this point the view could not be obtained, the leave
	if (pView != NULL)
	{
		CDocument* pDoc = pView->GetDocument();
		ASSERT(pDoc != NULL);
		if (pDoc != NULL)
		{
			CString strPathName = pDoc->GetPathName(); 

			if (!strPathName.IsEmpty())
			{
				CCFileSpec fs(strPathName);	//NOTE: This part is not portable!
				return fs.GetFileName();
			}
			else
			{
				return pDoc->GetTitle();
			}
		}
	}

	return _T("");
};
开发者ID:GFFavourite,项目名称:Script.NET,代码行数:40,代码来源:CTemplateFormater.cpp


注:本文中的CDocument::GetTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。