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

CPlatformFactory

Methods Index

Heritage
Description
Usage
Override
Public Methods
Protected Methods

CPlatformFactory


Heritage

Superclass: None

Subclass: None CPlatformFactoryDefault


Description

This abstract platform factory is by the framework to create platform- specific objects.


Usage

#include CGlobalClassLib_i
#include PwrFactoryDef_i
...
PLATFORM_FACTORY->
ConstructNativeControlDelegate(aNativeView);

Override

To override the object generation by CPlatformFactory, design a concrete subclass overriding only those virtual constructors you're interested in.

class CMyPlatFactory : public CPlatformFactory
{
public:
virtual CControlDelegate*
ConstructNativeControlDelegate(CNativeView* view)
{ return new CMyControlDelegate(view); }
CMyPlatFactory() : CPlatformFactory()
{}
};
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);
itsMyPlatFactory = new CMyPlatFactory;
mgr->AddFactory(kPlatformFactoryTypeId,
itsMyPlatFactory);
}
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 itsMyPlatFactory;
}

Public Methods

virtual ~CPlatformFactory();
virtual CControlDelegate* ConstructNativeControlDelegate(CNativeView*);
virtual CAttachmentWindow* ConstructAttachmentWindow(
CWindow *theEnclosure,
CAttachment *theAttachment,
BOOLEAN hasTitleBar);

Protected Methods

CPlatformFactory();


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

support@xvt.com


Visit our online help desk for tech support

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