Release 1.0  Copyleft ©1995 by Thomas Engel.  All Rights Reserved.

MiscPaperView



Inherits From: MiscColorView : View : Responder : Object

Declared In: misckit/MiscPaperView.h



Class Description

This class can draw its contents in many different papertypes...white lined, gray grid, yellow card with border, etc.
It was inspired by the NoteBook application which itself stole the idea from the paper store down the road.

You can change the background color, line or grid color/size and the type of border to draw. See the single method descriptions for detailed information on the possible settings.

Sidelines (borders) use the same settings but can be turn on and off for the single sides of the view.



Instance Variables

int gridType;

int gridVertOffset;

int gridHorOffset;

NXColor gridColor;

int gridOrigin;

int sidelineType;

int sidelineOffset;

NXColor sidelineColor;


gridType Holds the type of grid.
gridVertOffset The vertical offset (this is what separates horizontal lines).
gridHorOffset The horizontal offset (this is what separates horizontal lines).
gridColor The grids color.
gridOrigin Specifies in which corner the grid starts.
sidelineType Holds the type of borders we will draw.
sidelineOffset The offset each of the single borderlines has to the Views bounding box.
sidelineColor The border color.



Method Types

Initializing the class object + initialize
Initializing a new object - initFrame:
Controlling the grid - setGridColor:
- gridColor
- setGridType:withOrigin:
- gridType
- gridOrigin
- setGridSizeVertical:horizontal:
- verticalGridSize
- horizontalGridSize
Controlling the sidelines/borders
- setSidelineColor:
- sidelineColor
- setSidelineType:
- sidelineType
- setSidelineOffset:
- sidelineOffset
Drawing - drawSelf::
Archiving - read:
- write:




Class Methods

initialize
+ initialize

Initializes the class.

See also:  - initFrame:



Instance Methods

drawSelf::
- drawSelf:(const NXRect *)rects :(int)rectCount

Draws the grid and the borderlines according to the current settings.

See also:  - setGridType:withOrigin:, - setSidelineType:




gridColor

- (NXColor)gridColor

Returns the grid color.

See also:  - setGridColor:, - gridType




gridOrigin

- (int)gridOrigin

Returns the grids origin.

See also:  - setGridType:withOrigin:, - gridType




gridType

- (int)gridType

Returns the type of grid we will draw.

See also:  - setGridType:withOrigin:, - gridColor




horizontalGridSize

- (int)horizontalGridSize

Returns the horizontal grid size. This is the space between vertical lines.

See also:  - setGridSizeVertical:horizontal:




initFrame:

- initFrame:(const NXRect *)frameRect

The grid is by default light gray (33%) with offsets set to 20 in both directions. We will only draw horizontal lines starting in the top of the view on the left side.
The borders will be dark gray (66%) and one will be visible on the right side with and offset of 4 units (pixels)

See also:  - initialize




read:

- read:(NXTypedStream *)stream

Reads the object from a stream. We take care of versioning.

See also:  - write:, - initialize,




setGridColor:

- setGridColor:(NXColor)color

Sets the grids color to a color.

See also:  - gridColor, - setGridType:




setGridSizeVertical:horizontal:

- setGridSizeVertical:(int)vert horizontal:(int)hor

Sets the grid size in the vertical and horizontal direction. The code ensures that both are always at least 1.
Remember that vertical lines are seperated by horizontal space! So never mix the direction of the lines with the space between them.

See also:  - verticalGridSize, - horizontalGridSize




setGridType:withOrigin:

- setGridType:(int)aType withOrigin:(int)theOrigin

Sets the grids type and origin. The possible grid types are:

Constant Grid
Misc_PaperGridNone No grid
Misc_PaperGridHorizontal Horizonal lines only
Misc_PaperGridVertical Vertical lines only

To get a full grid combin both linetypes with an OR operation.
The grid origin can be set using:

Constant Origin
Misc_PaperGridStartsUpperLeft Left side on the top
Misc_PaperGridStartsUpperRight Right side on the top
Misc_PaperGridStartsLowerLeft Left side on the bottom
Misc_PaperGridStartsLowerRight Right side on the bottom

See also:  - gridType, - gridOrigin, - setGridSizeVertical:horizontal:




setSidelineColor:

- setSidelineColor:(NXColor)color

Sets the sidelines color to color.

See also:  - sidelineColor




setSidelineOffset:

- setSidelineOffset:(int)offset

Sets the off the borderlines have to their relating view border. The offset is the same for every line we have to draw.

See also:  - sidelineOffset




setSidelineType:

- setSidelineType:(int)aType

Specifies which sidelines get drawn or no.

Constant Lineposition
Misc_PaperSidelineNone Nowhere
Misc_PaperSidelineTop On the top
Misc_PaperSidelineBottom On the bottom
Misc_PaperSidelineLeft On the left
side
Misc_PaperSidelineRight On the right
side

You can create more then a single line by combining the single type with an OR operation.

See also:  - sidelineType, - setSidelineColor:




sidelineColor

- (NXColor)sidelineColor

Returns the color of the sidelines.

See also:  - setSidelineColor:




sidelineOffset

- (int)sidelineOffset

Returns the offset in which we will place the borderlines from the views frame.

See also:  - setSidelineOffset:




sidelineType

- (int)sidelineType

Returns the type of borders we will draw.

See also:  - setSidelineType:




verticalGridSize

- (int)verticalGridSize

Returns the vertical grid size. This is the space between horizontal lines.

See also:  - setGridSizeVertical:horizontal:




write:

- write:(NXTypedStream *)stream

Writes the object to a stream using the latest archiving version.

See also:  - read:, - initialize