ColourListComponentClass Class Reference

Provide a class that will add Colour List components to new documents. More...

#include <colcomp.h>

Inheritance diagram for ColourListComponentClass:

DocComponentClass ListItem CCObject SimpleCCObject List of all members.

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.

Detailed Description

Provide a class that will add Colour List components to new documents.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/08/94
See also:
DocComponentClass

Definition at line 128 of file colcomp.h.


Member Function Documentation

BOOL ColourListComponentClass::AddComponent BaseDocument pDocument  )  [virtual]
 

Add a colour list component to the specified document.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/08/94
Parameters:
pDocument - the document to add the colour list to. [INPUTS]
Returns:
TRUE if the colour list was added ok; FALSE if not.

Errors: Out of memory

See also:
ColourListComponentClass

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 }

BOOL ColourListComponentClass::Init void   )  [static]
 

Register the colour list document component with the main application.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
02/08/94
Returns:
TRUE if all went well; FALSE if not.

Errors: Out of memory.

See also:
DocComponent

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 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:56 2007 for Camelot by  doxygen 1.4.4