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

CViewFactory

Methods Index

Heritage
Description
Usage
Override
Public Methods
Protected Methods

CViewFactory


Heritage

Superclass: None

Subclass: CViewFactoryDefault


Description

This is the abstract factory used by CView and its subclasses.


Usage

#include CGlobalClassLib_i
#include PwrFactoryDef_i
...
CText* aText = VIEW_FACTORY->ConstructCText(aSubview,
aPoint, aString);

Override

To override the CText generation used by CButton, CListBox, CStatusBar, etc., you would define a concrete subclass of CViewFactory like this:

class CMyViewFactory : public CViewFactory
{
public:
virtual CText* ConstructCText(CSubview* theSubview,
const CPoint& thePoint, const CStringRW&
theString)
{ return new CMyText(theSubview, thePoint,
theString); }
CMyViewFactory() : CViewFactory()
{}
};
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);
itsMyViewFactory = new CMyViewFactory;
mgr->AddFactory(kViewFactoryTypeId,
itsMyViewFactory);
}
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 itsMyViewFactory;
}

Public Methods

virtual CText* ConstructCText(CSubview*, 
const CPoint&, const CStringRW&);
virtual CPicture* ConstructCPicture(CSubview*, 
const CPoint&, const CImage&);
virtual CFixedGrid* ConstructCFixedGrid(CSubview*, 
const CPoint&, UNITS, UNITS, int, int);
virtual CGlue* ConstructGlue(CView*);
virtual CWireFrame* ConstructWireFrame(CView*);
virtual ~CViewFactory();

Protected Methods

CViewFactory();


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

support@xvt.com


Visit our online help desk for tech support

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