#include <colcomp.h>
Inheritance diagram for ColourListComponentClass:
Public Member Functions | |
BOOL | AddComponent (BaseDocument *) |
Add a colour list component to the specified document. | |
Static Public Member Functions | |
static BOOL | Init () |
Register the colour list document component with the main application. |
Definition at line 128 of file colcomp.h.
|
Add a colour list component to the specified document.
Implements DocComponentClass. Definition at line 210 of file colcomp.cpp. 00211 { 00212 // Check to see if this document already has a colour list; if so, leave it alone. 00213 if (pDocument->GetDocComponent(CC_RUNTIME_CLASS(ColourListComponent)) != NULL) 00214 return TRUE; 00215 00216 // No colour list - try to create a new one for this document. 00217 ColourList *pList = new ColourList; 00218 if(pList == NULL) 00219 return FALSE; 00220 00221 pList->Init( pDocument ); // Let the ColourList know what its parent document is 00222 00223 // Ok - create the colour list component using this list. 00224 ColourListComponent *pComponent = new ColourListComponent(pList); 00225 if (pComponent == NULL) 00226 { 00227 // Out of memory... 00228 delete pList; 00229 return FALSE; 00230 } 00231 00232 // All ok - add the component to the document. 00233 pDocument->AddDocComponent(pComponent); 00234 return true; 00235 }
|
|
Register the colour list document component with the main application.
Reimplemented from SimpleCCObject. Definition at line 180 of file colcomp.cpp. 00181 { 00182 // Instantiate a component class to register with the application. 00183 ColourListComponentClass *pClass = new ColourListComponentClass; 00184 if (pClass == NULL) 00185 return FALSE; 00186 00187 // Register it 00188 GetApplication()->RegisterDocComponent(pClass); 00189 00190 // All ok 00191 return TRUE; 00192 }
|