| Methods Index |
CNotifierSubclasses: None
CResourceItems is a convenience class which automatically takes care of holding and releasing the resource it is associated with.To use this convenience class, a resource must already be registered with
CResourceMgr. If the resource has not been created (therefore registered with CResourceMgr), CResourceItems constructor will assert.
// Get resource (will hold and release accordingly):
CResourceItems theRes(theMenu);
theRes.First(); // reset iteratation
// Traverse through menubar and add submenu
// accordingly:
long theMenuId;
while (theMenuId = theRes.Next()) {
CSubmenu theSubmenu;
theRes.IObject(theMenuId, &theSubmenu);
// creates nested items/submenus
AppendSubmenu(theSubmenu);
}
|
|
|
|
CResource*
|
itsResource
| The associated resource |
CResourceItems(long theId);
CResourceMgr list of resources and calls the resource's Hold method (see the CResource description). When you destroy the resource, it releases it automatically by calling the resource Release method.
virtual ~CResourceItems(void);
Release on its associated resource (itsResource).
CResourceItems(const CResourceItems &theResource);
CResourceItem into another. It also calls Hold on the associated resource.
CResourceItems & operator = (
const CResourceItems &theResource);
CResourceItems equal to another.
virtual long First(void);
itsResource FirstItem method and returns the resource ID.
virtual long Next(void);
itsResource NextItem method and returns the resource ID.
virtual long GetType(long theId);
itsResource GetItemType method and returns the type.
virtual BOOLEAN IObject(long theId,
CObjectRWC *theObject);
itsResource IObject method and returns TRUE if the initialization succeeds.