[Home] [Prev] [Next] [Up]


XGViewFactory class

Translates a view identifier into a view.

Usage:

#include <XView.h>

class XGViewFactory;

Description

This class is the core of the view construction system.

The XGViewFactory objects all reside on a linked list of view factories. When the XGWindow::Create method is called to create a window from a 'VRes' resource, the different views are recursively constructed by taking the view type (generally, a four-letter specification like 'view' or 'text'), and calling each of the different factory objects until one actually constructs the view.

If no factory objects exist which can construct the view, a default 'view' object (an instance of the XGView class) is created, and a warning is displayed.

If you want to create a series of custom classes, one of the things you need to do is to create a new XGViewFactory child and override the CreateView method. This method should create the views you want.

Construction/Destruction

XGViewFactory::XGViewFactory()

This adds this factory to a global linked list of view construction factories.

XGViewFactory::~XGViewFactory()

This removes the factory from the global linked list of view factories.

Creation of new views

XGView *XGViewFactory::CreateView(long view, XGView *parent, XGArgStream &stream);

This virtual method should be overriden. This method is called when it is time to create a new view; the view parameter specifies the ID of the view. The parent is the parent view of the view to be constructed, and the stream argument provides the initialization parameters from the 'VRes' resource which specifies this view.

If this cannot construct the view specified, this should return NULL.

NOTE: For more information on the format of the VRes resource, see the CompileVRes documentation.


[Home] [Prev] [Next] [Up]