Programming Reference: ODOS2Canvas

# Programming Reference

## ODOS2Canvas

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

Class Hierarchy

    SOMObject
       ODObject
          ODPlatformCanvas
             ODOS2Canvas

Description | ODOS2Canvas is an OS/2 specific class that serves as a platform parent class for other classes used to encapsulate window's drawing contexts. The ODOS2Canvas is derived from ODPlatformCanvas and wraps a presentation space. It can be instantiated directly to access the CreateConcreteCanvas factory method for creating instances of ODOS2StandardCanvas and ODOS2WindowCanvas. These two classes override 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 an ODOS2Canvas.

Methods

The methods defined for the ODOS2Canvas class include:

- GetPS (OS/2)
- GetWindow (OS/2)
- InitPlatformCanvas (OS/2)
- InitPlatformWindowCanvas (OS/2)
- ReleasePS (OS/2)
- SetPS (OS/2)

Overridden Methods

The methods overridden by the ODOS2Canvas class include:

- ODPlatformCanvas::CreateConcreteCanvas
- ODPlatformCanvas::GetPlatformCanvasType
- ODPlatformCanvas::GetSystemType
- ODPlatformCanvas::HasWindow
- ODPlatformCanvas::IsInitialized

### GetPS (OS/2)

This method returns a handle to the presentation space of this platform canvas.

Signature

    HPS *GetPS ()

Parameters

None.

Returns

rv (HPS) - returns

  A handle to the presentation space of the platform canvas.

Remarks

This method must be overridden by a subclass and will return a kODErrInvalidObjectType if this platform canvas is an ODOS2Canvas. If this platform canvas is a subclass and is initialized, then the handle to the presentation space will be returned. If this platform canvas is an ODOS2WindowCanvas, then you must release the presentation space using ReleasePS when you finish drawing.

Exception Handling

kODErrInvalidObjectType | This method is not valid on this object.

### GetWindow (OS/2)

This method returns a reference to the window associated with this platform canvas.

Signature

    HWND GetWindow ()

Parameters

None.

Returns

rv (HWND) - returns

  A reference to the window handle.

Remarks

This method must be overridden by a subclass and returns a kODErrInvalidObjectType if this platform canvas is an ODOS2Canvas. If this platform canvas is an ODOS2WindowCanvas and is initialized, then it returns the window associated with this platform canvas.

Exception Handling

kODErrInvalidObjectType | This method is not valid on this object.

### InitPlatformCanvas (OS/2)

This method initializes the platform canvas using a handle to a presentation space.

Signature

    void InitPlatformCanvas (HPS hps)

Parameters

hps (HPS) - input

  A handle to a valid presentation space.

Returns

None.

Remarks

This method must be overridden by a subclass. This method returns kODErrInvalidObjectType if this platform canvas is an ODOS2Canvas.

Exception Handling

kODErrInvalidObjectType | This method is not valid on this object.

### InitPlatformWindowCanvas (OS/2)

This method initializes the platform canvas using a handle to a window.

Signature

    void InitPlatformWindowCanvas (HWND hwnd)

Parameters

hwnd (HWND) - input

  A handle to a valid presentation space.

Returns

None.

Remarks

This method must be overridden by a subclass. This method returns kODErrInvalidObjectType if this platform canvas is an ODOS2Canvas.

Exception Handling

kODErrInvalidObjectType | This method is not valid on this object.

### ReleasePS (OS/2)

This method decrements the reference count and releases the presentation space when the reference count reaches zero.

Signature

    void ReleasePS ()

Parameters

None.

Returns

None.

Remarks

This method must be overridden by a subclass and returns a kODErrInvalidObjectType if this platform canvas is an ODOS2Canvas. If this platform canvas is an ODOS2WindowCanvas and is initialized, then it decrements the reference count. When the reference count reaches zero, the presentation space is released.

Exception Handling

kODErrInvalidObjectType | This method is not valid on this object.

### SetPS (OS/2)

This method sets the presentation space of this platform canvas.

Signature

    void SetPS ()

Parameters

None.

Returns

None.

Remarks

This method must be overridden by a subclass and returns a kODErrInvalidObjectType if this platform canvas is an ODOS2Canvas. If this platform canvas is a subclass and is initialized, then this method returns the handle to the presentation space. If this platform canvas is an ODOS2WindowCanvas, then you must release the presentation space using ReleasePS when you finish drawing.

Exception Handling

kODErrInvalidObjectType | This method is not valid on this object.

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