| Methods Index |
CNotifierSubclasses: None
CResourceMgr is the XVT-Power++ resource manager. Resources are registered in the CResourceMgr list of resources, and can be queried using the CResourceMgr::Find method. There is only one instance of CResourceMgr. It is instantiated in the CGlobalLibClass constructor automatically called by the CApplication constructor. Because any member of CGlobalClassLib is freed when the application quits, resource related memory is also automatically released. In essence, CResourceMgr carries out automatic garbage collection.To add a resource to
CResourceMgr, a program first creates the resource, then inserts it using the CResourceMgr::Insert method. Typically this is done in the constructor of a CResource derived class. With XVT-Power++ 3.0, CResourceMgr manages two types of resources: windows and menubars. Windows are automatically registered in the CWindow constructor, which loads a window from resource file. Menus are automatically registered in the CMenuBar constructor.
CResourceMgr *theResMgr = G->GetResourceMgr();
CResource *theWinRes = new CResourceWindow(WIN_101);
CResource *theStrRes = nre CResourceStrings(FIRST_ID, LAST_ID);
//example of range
theResMgr->Insert(theWinRes);
theResMgr->Insert(theWinRes);
const RWOrdered *theResList = theResMgr->Find(FIRST_ID);
RWOrderedIterator doTo(theResList);
...
|
|
|
|
RWOrdered*
|
itsResources;
|
Collection of resources maintained by CResourceMgr
|
CResourceMgr(void);
CGlobalClassLib constructor.
virtual ~CResourceMgr(void);
CResourceMgr.
long Insert(CResource* theResource);
CResource theResource in the CResourceMgr list of resources. This method returns the resource ID.
BOOLEAN Remove(long theId, BOOLEAN IsDelete=FALSE);
theId. It removes the associated CResource object from its list of resources. If the flag IsDelete is TRUE, then the resource itself is also deleted.
CResource* Find(long theId);
theId, locates a CResource in itsResources list and returns it.
const RWOrdered* GetResources(void) const;
itsResources.
CResourceMgr(const CResourceMgr& theResourceMgr);
CResourceMgr& operator= (
const CResourceMgr& theResourceMgr);