[Classes] [Prev] [Next] [Methods]

CApplicationFactory

Methods Index

Heritage
Description
Usage
Override
Public Methods
Protected Methods

CApplicationFactory


Heritage

Superclass: None

Subclass: CApplicationFactoryDefault


Description

This abstract factory class is used by the framework to create the task document, the task window, and so on.


Usage

Note: These virtual constructors are invoked only by CApplication. See CApplication::StartUp for details.

#include CGlobalClassLib_i
#include PwrFactoryDef_i
...
APPLICATION_FACTORY->ConstructTaskDoc(this, TASKDOCid);

Override

To override the CTaskDoc generation by CApplication (for example), design a concrete subclass of CApplicationFactory, overriding only those virtual constructors you're interested in:

class CMyAppFactory : public CApplicationFactory
{
public:
virtual CTaskDoc* ConstructTaskDoc(CApplication*
app, long id)
{ return new CMyTaskDoc(app, id); }
CMyAppFactory() : CApplicationFactory()
{}
};
Then install an instance of this factory into the factory manager, as soon as the manager is created, within CApplication::InstallFactories(...).

void CMyApplication::InstallFactories(CFactoryMgr* mgr)
{
CApplication::InstallFactories(mgr);
itsMyAppFactory = new CMyAppFactory;
mgr->AddFactory(kApplicationFactoryTypeId,
itsMyAppFactory);
}
Then remember to delete the factory after it is no longer used, because the factory manager will not delete it for you.

void CMyApplication::ShutDown()
{
CApplication::ShutDown();
delete itsMyAppFactory;
}

Public Methods

virtual CTaskDoc* ConstructTaskDoc(CApplication*, 
long theId);
virtual CTaskWin* ConstructTaskWin(CDocument*, 
WINDOW theXVTWindow);
virtual CPrintMgr* ConstructPrintMgr();
virtual CDesktop* ConstructDesktop(CApplication*);
virtual CResourceMgr* ConstructResourceMgr();
virtual CControllerMgr* ConstructControllerMgr();
virtual ~CApplicationFactory();

Protected Methods

CApplicationFactory();


[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.