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

CMenuFactory

Methods Index

Heritage
Description
Usage
Override
Public Methods
Protected Methods

CMenuFactory


Heritage

Superclass: None

Subclass: None


Description

This abstract factory class is used by the framework to create menu objects.


Usage

#include CGlobalClassLib_i
#include PwrFactoryDef_i
...
MENU_FACTORY->ConstructCMenubar(aWin, aTag);

Override

To override the CSubmenu generation by CMenu, for example, design a concrete subclass of CMenuFactory, overriding only those virtual constructors you're interested in.

class CMyPlatFactory : public CMenuFactory
{
public:
virtual CSubmenu* ConstructCSubmenu(const
CSubmenu&);
{ return new CMySubmenu(); }
CMyPlatFactory() : CMenuFactory()
{}
};
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(kMenuFactoryTypeId, 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 CSubmenu* ConstructCSubmenu(const CSubmenu&);
virtual CMenuItem* ConstructCMenuItem(const CMenuItem&);
virtual CMenuBar* ConstructCMenuBar(CWindow*, MENU_TAG, 
BOOLEAN isImport);
virtual ~CMenuFactory();

Protected Methods

CMenuFactory();


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

support@xvt.com


Visit our online help desk for tech support

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