Public Member Functions | Private Attributes

GR_GraphicsFactory Class Reference

#include <gr_Graphics.h>

List of all members.

Public Member Functions

 GR_GraphicsFactory ()
virtual ~GR_GraphicsFactory ()
UT_uint32 getClassCount () const
bool registerClass (GR_Allocator, GR_Descriptor, UT_uint32 iClassId)
UT_uint32 registerPluginClass (GR_Allocator, GR_Descriptor)
void registerAsDefault (UT_uint32 iClassId, bool bScreen)
UT_uint32 getDefaultClass (bool bScreen) const
bool unregisterClass (UT_uint32 iClassId)
bool isRegistered (UT_uint32 iClassId) const
GR_GraphicsnewGraphics (UT_uint32 iClassId, GR_AllocInfo &param) const
const char * getClassDescription (UT_uint32 iClassId) const

Private Attributes

UT_GenericVector< GR_Allocatorm_vAllocators
UT_GenericVector< GR_Descriptorm_vDescriptors
UT_NumberVector m_vClassIds
UT_uint32 m_iDefaultScreen
UT_uint32 m_iDefaultPrinter

Constructor & Destructor Documentation

GR_GraphicsFactory::GR_GraphicsFactory (  )  [inline]
virtual GR_GraphicsFactory::~GR_GraphicsFactory (  )  [inline, virtual]

Member Function Documentation

UT_uint32 GR_GraphicsFactory::getClassCount (  )  const [inline]
const char * GR_GraphicsFactory::getClassDescription ( UT_uint32  iClassId  )  const
UT_uint32 GR_GraphicsFactory::getDefaultClass ( bool  bScreen  )  const [inline]
bool GR_GraphicsFactory::isRegistered ( UT_uint32  iClassId  )  const
GR_Graphics * GR_GraphicsFactory::newGraphics ( UT_uint32  iClassId,
GR_AllocInfo param 
) const

Creates an instance of the graphics class represented by iClassId, passing param to the class allocator.

References UT_GenericVector< T >::findItem(), UT_GenericVector< T >::getNthItem(), GRID_DEFAULT, GRID_DEFAULT_PRINT, m_iDefaultPrinter, m_iDefaultScreen, m_vAllocators, and m_vClassIds.

Referenced by XAP_App::newGraphics().

void GR_GraphicsFactory::registerAsDefault ( UT_uint32  iClassId,
bool  bScreen 
) [inline]
bool GR_GraphicsFactory::registerClass ( GR_Allocator  allocator,
GR_Descriptor  descriptor,
UT_uint32  iClassId 
)

Registers the class allocator and descriptor functions with the factory.

allocator is a static intermediary to the graphics constructor; it takes a parameter of type GR_AllocInfo*, which should point to any data the allocator needs to pass onto the constructor.

descriptor is a static function that returns a string that describes the graphics class in human-readable manner (e.g., to be shown in dialogues).

Returns true on success, false if requested id is already registered (except for IDs < GRID_LAST_DEFAULT, which will automatically be reassigned).

This function is to be used by built-in classes; plugins should use registerPluginClass() instead.

The default platform implementation of the graphics class should register itself twice, once with its predefined id and once as the default class.

References UT_GenericVector< T >::addItem(), UT_GenericVector< T >::findItem(), GRID_LAST_DEFAULT, m_vAllocators, m_vClassIds, m_vDescriptors, and UT_return_val_if_fail.

Referenced by registerPluginClass(), XAP_CocoaApp::XAP_CocoaApp(), XAP_QtApp::XAP_QtApp(), and XAP_UnixApp::XAP_UnixApp().

UT_uint32 GR_GraphicsFactory::registerPluginClass ( GR_Allocator  allocator,
GR_Descriptor  descriptor 
)

As registerClass() but to be used by plugins; it automatically allocates an id for the class by which it will be identified.

Returns:
id > 0 on success, 0 on failure

References GRID_UNKNOWN, registerClass(), and UT_return_val_if_fail.

bool GR_GraphicsFactory::unregisterClass ( UT_uint32  iClassId  ) 

Unregisteres class with the given id; this function is only to be used by plugins.

Returns true on success.

The caller must never try to unregister any other class that itself; the sole exception to this is GRID_DEFAULT

The built-in graphics classes cannot be unregistered.

References UT_GenericVector< T >::deleteNthItem(), UT_GenericVector< T >::findItem(), GRID_LAST_BUILT_IN, m_iDefaultPrinter, m_iDefaultScreen, m_vAllocators, m_vClassIds, m_vDescriptors, and UT_return_val_if_fail.


Member Data Documentation


The documentation for this class was generated from the following files: