Programming Reference: ODPlatformCanvas

# Programming Reference

## ODPlatformCanvas

Class Definition File | PlatCanv.idl
Class C++ Binding | PlatCanv.xh

Class Hierarchy

    SOMObject
       ODObject
          ODPlatformCanvas

Description

ODPlatformCanvas is a class that serves as a platform independent parent class for other classes used to encapsulate drawing contexts specific to the platform and graphics library. The methods of the platform-specific derived classes expose the unique characteristics of the drawing contexts of that platform.

On OS/2, the ODOS2Canvas class is derived from ODPlatformCanvas and wraps one or more GPI presentation spaces. It must not be instantiated directly, for it serves as a parent class for ODOS2StandardCanvas and ODOS2WindowCanvas. ODOS2StandardCanvas is nearly all of the methods of ODOS2Canvas. ODOS2StandardCanvas initializes offscreen static, offscreen dynamic and onscreen static canvases. ODOS2WindowCanvas initializes onscreen dynamic canvases. Because ODOS2StandardCanvas and ODOS2WindowCanvas do not introduce any new methods, objects of both classes can be referred to using a pointer to the base class ODOS2Canvas.

On Windows, the ODWin32Canvas is derived from ODPlatformCanvas and wraps a drawing context (DC). It must not be instantiated directly, for is serves as a parent class for ODWin32StandardCanvas and methods of ODWin32Canvas. ODWin32StandardCanvas initializes offscreen static, offscreen dynamic, and onscreen static canvases. ODWin32WindowCanvas initializes onscreen dynamic canvases. Because ODWin32StandardCanvas and ODWin32WindowCanvas do not introduce any new methods, objects of both classes can be referred to using a pointer to the base class ODWin32Canvas.

For AIX, the ODAIXCanvas is derived from ODPlatformCanvas and wraps an X-Window graphics context (GC). It must not be instantiated directly, for it serves as a parent class for ODAIXStandardCanvas and ODAIXWindowCanvas. These two classes override nearly all of the methods of ODAIXCanvas. ODAIXStandardCanvas initializes offscreen static, offscreen dynamic, and onscreen static canvases. ODAIXWindowCanvas initializes onscreen dynamic canvases. Because ODAIXStandardCanvas and ODAIXWindowCanvas do not introduce any new methods, objects of both classes can be referred to using a pointer to the base class ODAIXCanvas.

Methods

The methods defined by the ODPlatformCanvas class include:

- CreateConcreteCanvas
- GetPlatformCanvasType
- GetSystemType
- HasWindow
- IsInitialized

Overridden Methods | There are no methods overridden by the ODPlatformCanvas class.

### CreateConcreteCanvas

This method is a factory method that creates an instance of a platform-specific canvas object.

Signature

    ODPlatformCanvas *CreateConcreteCanvas (ODGraphicsSystem g,
                                            ODBoolean isDynamic,
                                            ODBoolean isOffScreen)

Parameters

g (ODGraphicsSystem) - input

  The graphics system you want to use for this platform canvas. Valid graphics systems are platform dependent:
  - For OS/2, use kODPM.
  - For Windows, use kODWin32, kODWin95, or kODWinNT.
  - For AIX, use kODAIX.

isDynamic

  A flag indicating whether this platform canvas is to be dynamic.

  kODTrue | The platform canvas is to be dynamic.
  kODFalse | The platform canvas is to be static.

isOffScreen

  A flag indicating whether this platform canvas is to be offscreen.

  kODTrue | The platform canvas is to be offscreen.
  kODFalse | The platform canvas is to be onscreen.

Returns

rv (ODPlatformCanvas *) - returns

  A reference to a new platform canvas.

Remarks

Your part calls this method to create a platform-specific canvas object.

Exception Handling

kODErrInvalidGraphicsSystem | The ODGraphicsSystem was invalid.

### GetPlatformCanvasType

This method returns the platform canvas type of the platform canvas object.

Signature

    ODPlatformCanvasType GetPlatformCanvasType ()

Parameters

None.

Returns

rv (ODPlatformCanvasType) - returns

  The platform canvas type.

Remarks

This method returns an ODPlatformCanvasType for the platform canvas. This can be kODNoPlatformCanvas, kODPlatformStandardCanvas, or kODPlatformWindowCanvas. If kODNoPlatformCanvas is returned, this platform canvas is one of the parent classes and cannot be used to wrap a platform-specific drawing context. An instance of one of the platform-specific derived classes must be created, for example, an ODWin32WindowCanvas on the Windows platform.

### GetSystemType

This method returns the graphics system type of the platform canvas.

Signature

    ODGraphicsSystem GetSystemType ()

Parameters

None.

Returns

rv (ODGraphicsSystem) - returns

  The platform system type.

Remarks

This method returns an ODGraphicsSystem type for this platform canvas. If kODNoGraphicsSystem is returned, this platform canvas is one of the parent classes and cannot be used to wrap a platform-specific drawing context. An instance of one of the platform-specific derived classes must be created, for example, an ODWin32Window Canvas on the Windows platform.

### HasWindow

This method indicates whether this platform canvas has a window.

Signature

    ODBoolean HasWindow ()

Parameters

None.

Returns

rv (ODBoolean) - returns

  This method returns the following value:

  kODTrue | This platform canvas has a window.
  kODFalse | This platform canvas does not have a window.

### IsInitialized

This method indicates whether this platform canvas has been initialized.

Signature

    ODBoolean IsInitialized ()

Parameters

None.

Returns

rv (ODBoolean) - returns

  This method returns the following value:

  kODTrue | This platform canvas has been initialized.
  kODFalse | This platform canvas has not been initialized.

[ Top | Previous | Next | Contents | Index | Documentation Homepage ]