beautypg.com

Using drawing view classes and protos 13 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 540

background image

C H A P T E R 1 3

Drawing and Graphics

13-14

Using the Drawing Interface

Using Drawing View Classes and Protos

13

Four view classes and three protos, which you can use to create your own templates,
are built into the system. The view classes include:

clPolygonView

—displays polygons or ink, or accepts graphic or ink input.

clPictureView

—displays a bitmap or picture object shape.

clEditView

—edits views that can accept both text and graphic user input.

clRemoteView

—displays a scaled image of another view.

The protos include:

protoImageView

—provides a view in which you can display, magnify, scroll,

and annotate images.

protoThumbnail

—is used in conjunction with a

protoImageView

. It

displays a small copy of the image with a rectangle representing the location and
panel in the image.

protoThumbnailFloater

—provides a way to use a thumbnail, but also

adjusts the thumbnail’s size to reflect the aspect ratio of the image that it contains.

Displaying Graphics Shapes and Ink

13

Use the

clPolygonView

class to display polygons and ink, or to accept graphic

or ink input. The

clPolygonView

class includes these features:

Shape recognition and editing, such as stretching of shapes from their vertices,
view resizing, scrubbing, selection, copying to clipboard, duplicating, and other
gestures, as controlled by the setting of the

viewFlags

slot.

Snapping of new line endpoints to nearby vertices and midpoints of existing shapes.

Automatic resizing to accommodate enlarged shapes (when the view is enclosed
in a

clEditView

). This feature is controlled by the

vCalculateBounds

flag

in the

viewFlags

slot.

Views of the

clPolygonView

class are supported only as children of views of the

clEditView

class. In other words, you can put a

clPolygonView

only inside a

clEditView

.

You don’t need to create polygon views yourself if you are accepting user input
inside a

clEditView

. You simply provide a

clEditView

and when the user

draws in it, the view automatically creates polygon views to hold shapes.