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


C++ CWinApp::AddDocTemplate方法代码示例

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


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

示例1: GetApp

// @pymethod |PyCWinApp|AddDocTemplate|Adds a template to the application list.
static PyObject *
ui_app_add_doc_template(PyObject *self, PyObject *args)
{
	PyObject *obTemplate;
	if (!PyArg_ParseTuple(args,"O:AddDocTemplate",
	                      &obTemplate))     // @pyparm <o PyCDocTemplate>|template||The template to be added.
		return NULL;

	if (!ui_base_class::is_uiobject(obTemplate, &PyCDocTemplate::type))
		RETURN_TYPE_ERR("The parameter must be a template object");

	CDocTemplate *pTempl = PyCDocTemplate::GetTemplate(obTemplate);
	if (pTempl==NULL)
		return NULL;
	CWinApp *pApp = GetApp();
	if (!pApp) return NULL;
	// walk all templates in the application looking for it.
	CDocTemplate* pTemplate;
	POSITION pos = pApp->m_pDocManager ? pApp->m_pDocManager->GetFirstDocTemplatePosition() : NULL;
	while (pos != NULL) {
		pTemplate = pApp->m_pDocManager->GetNextDocTemplate(pos);
		if (pTemplate==pTempl)
			RETURN_ERR("The template is already in the application list");
	}
	GUI_BGN_SAVE;
	pApp->AddDocTemplate(pTempl);
	GUI_END_SAVE;
	RETURN_NONE;
}
开发者ID:DavidGuben,项目名称:rcbplayspokemon,代码行数:30,代码来源:win32app.cpp

示例2: Initialize

//---------------------------------------------------------------------
// Function:	Initialize
// Description:	Initialization like InitInstace
// Parameters:	.
// Returns:		TRUE, if successful
//---------------------------------------------------------------------
BOOL CObjectTexture::Initialize()
{
	CString tName;
	HINSTANCE appInst;
	CMDIFrameWnd *mainWnd;
		
	// Register the doc templates we provide to the app
	CWinApp* pApp = AfxGetApp();
	ASSERT(pApp != NULL);
    if (pApp == NULL)
    {
        return FALSE;
    }

	mainWnd = DYNAMIC_DOWNCAST(CMDIFrameWnd, pApp->m_pMainWnd);

	// get the apps instance handle for loading resources
	appInst = AfxGetResourceHandle();
	// now tell the application to look in dll for resources
	AfxSetResourceHandle(ObjectTextureDLL.hModule);

	// use my string / icon resources
	// *** note IDR_TEXTURE type needs to be unique ID even between
	// dlls
	m_DocTemplate = new CMultiDocTemplate(IDR_TEXTURETYPE,
			RUNTIME_CLASS(CTextureDoc),
			RUNTIME_CLASS(CMDIChildWnd),
			RUNTIME_CLASS(CTextureView));

	pApp->AddDocTemplate(m_DocTemplate);

	VERIFY(MergeMenus(&m_DocTemplate->m_hMenuShared, *(m_ProgramInfo->curMenu), _T("&Window")));	
	VERIFY(MergeAccelerators(&m_DocTemplate->m_hAccelTable, *(m_ProgramInfo->curAccel)));

	// Initialze the image library
	ilInit();
	iluInit();
	ilutInit();

	// construct resource info
	m_ObjInfo.name.LoadString(IDS_OBJECT_NAME);
	m_ObjInfo.pageIndex = &m_PageIndex;

	m_ObjInfo.icon = (HICON)LoadImage(ObjectTextureDLL.hModule, MAKEINTRESOURCE(IDR_TEXTURETYPE), 
		IMAGE_ICON, 0, 0, LR_CREATEDIBSECTION);
	VERIFY(m_ObjInfo.icon != NULL);

	// value should be 1 - 1000
	m_ObjInfo.priority = IDR_TEXTURETYPE;
	m_ObjInfo.objFlags = OBJFLAGS_EXPORTABLE |
		OBJFLAGS_IMPORTABLE | OBJFLAGS_THUMBNAIL;

	AfxSetResourceHandle(appInst);

    return TRUE;

}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:63,代码来源:ObjectTexture.cpp

示例3: Initialize

//---------------------------------------------------------------------
// Function:	Initialize
// Description:	DLL's Initialization function, like InitInstance
// Parameters:	.
// Returns:		TRUE, if successful.
//---------------------------------------------------------------------
BOOL CStateMachineEditor::Initialize()
{
	CString tName;
	HINSTANCE appInst;
		
	// Register the doc templates we provide to the app
	CWinApp* pApp = AfxGetApp();
	ASSERT(pApp != NULL);
    if (pApp == NULL)
    {
        return FALSE;
    }

	// get the apps instance handle for loading resources
	appInst = AfxGetResourceHandle();
	// now tell the application to look in dll for resources
	AfxSetResourceHandle(StateMachineEditorDLL.hModule);

	// use my string / icon resources
	// Note IDR_EXAMPLETYPE has to be a unique id even between DLLS
	// to get the ICONS right on the Window
	m_DocTemplate = new CMultiDocTemplate(IDR_STATEMACHINETYPE,
			RUNTIME_CLASS(CStateMachineEditorDoc),
			RUNTIME_CLASS(CStateMachineEditorFrm),
			RUNTIME_CLASS(CStateMachineEditorView));

	//// put this after setting the menu and accelerators so it won't allocate it's own
	pApp->AddDocTemplate(m_DocTemplate);

	// construct resource info
	m_ObjCollection.name.LoadString(IDS_RESOURCE_NAME);
	m_ObjCollection.pageIndex = &m_PageIndex;

	m_ObjCollection.hIcon = (HICON)LoadImage(StateMachineEditorDLL.hModule, MAKEINTRESOURCE(IDR_STATEMACHINETYPE), 
		IMAGE_ICON, 0, 0, LR_CREATEDIBSECTION);
	VERIFY(m_ObjCollection.hIcon != NULL);

	// value should be 1 - 1000
	m_ObjCollection.priority = IDR_STATEMACHINETYPE;
	m_ObjCollection.extensions = STATEMACHINE_EXTENSIONS;

	AfxSetResourceHandle(appInst);

    return TRUE;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:51,代码来源:StateMachineEditor.cpp

示例4: Initialize

BOOL CParticleEditor::Initialize( )
{
	CWinApp* pApp = AfxGetApp();
	ASSERT(pApp != NULL);
    if (pApp == NULL)
    {
        return FALSE;
    }

	// get the apps instance handle for loading resources
	m_AppInst = AfxGetResourceHandle();

	//Direct the application to look in dll for resources
	AfxSetResourceHandle(ParticleEditorDLL.hModule);

	// use my string / icon resources
	// Note IDR_EXAMPLETYPE has to be a unique id even between DLLS
	// to get the ICONS right on the Window
	m_DocTemplate = new CMultiDocTemplate(IDR_PARTICLETYPE,
			RUNTIME_CLASS(CParticleDoc),
			RUNTIME_CLASS(CParticleFrame),
			RUNTIME_CLASS(CParticleRenderView));

	// put this after setting the menu and accelerators so it won't allocate it's own
	pApp->AddDocTemplate(m_DocTemplate);

	// construct resource info
	m_ObjCollection.name.LoadString(IDS_RESOURCE_NAME);
	m_ObjCollection.pageIndex = &m_PageIndex;

	m_ObjCollection.hIcon = (HICON)LoadImage(ParticleEditorDLL.hModule, MAKEINTRESOURCE(IDR_PARTICLETYPE), 
		IMAGE_ICON, 0, 0, LR_CREATEDIBSECTION);
	VERIFY(m_ObjCollection.hIcon != NULL);

	// value should be 1 - 1000
	// NOTE: Against convention this was set at coding to 31000 even the example is set at 5000
	m_ObjCollection.priority = IDR_PARTICLETYPE; 
    m_ObjCollection.extensions = PARTICLE_EXTENSIONS;
    AfxSetResourceHandle(m_AppInst);

	return TRUE;
}
开发者ID:klhurley,项目名称:ElementalEngine2,代码行数:42,代码来源:ParticleEditor.cpp

示例5: PIRegisterDocTemplates

// register plugin document templates
PLUGIN_EXPORT void PIRegisterDocTemplates()
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	CPluginSupportApp* pApp = (CPluginSupportApp*)AfxGetApp();
	CWinApp* pMainApp = pApp->GetMainApp();

	const PluginArray& array = pApp->GetPluginArray();
	for (int i=0; i<array.GetSize(); i++)
	{
		CPluginWrapper* pPluginWrapper = array.GetAt(i);
		for (int j = 0; j < pPluginWrapper->GetDocTemplateCount(); j++)
		{
			CDocTemplate* pDocTemplate = pPluginWrapper->GetDocTemplate(j);
			// plugin said it had one, but didn't supply it
			ASSERT(pDocTemplate);
			pMainApp->AddDocTemplate(pDocTemplate);
		}
	}
}
开发者ID:chrisluu,项目名称:Plugin,代码行数:21,代码来源:PluginImpl.cpp


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