Release 1.0  Copyright ã1993 by NeXT Computer, Inc.  All Rights Reserved.

DBTableViewPrinter

Inherits From:	View : Object

Declared In:	DBTableViewPrinter.h

Class Description

DBTableViewPrinter is a class which nicely formats and prints DBTableViews.  Typically, DBTableViewPrinter is not instantiated directly, but rather automatically when a TablePrinter class is instantiated.  DBTableViewPrinter is for printing only, and therefore was designed to reside in an off screen view.  None-the-less, once properly instantiated, it can be messaged to set and change formatting parameters.

Required Usage of TablePrintPanel

The TablePrintPanel object included with TablePrinter Palette is a subclass of PrintPanel which allows the setting of pages per row, so that it can adjust the total pages sent to the printer to reflect compound pages.  For instance, if you ask to print from 2 to 2 on a table that is three pages wide, It will set PrintInfo to print 4 through 6.  It is essential that TablePrintPanel be the first PrintPanel referenced anywhere in an application which uses a DBTableViewPrinter.  This is because an Application only has one PrintPanel object.  If the regular PrintPanel object gets referenced (and subsequently loaded) first by another place in an application, then attempts by DBTableViewPrinter to message TablePrintPanel will fail.  If TablePrintPanel is loaded first, all other references to PrintPanel will work without a hitch, as if there were no change.  A simple message like:

	[TablePrintPanel new];

in the  ± appDidInit: method will solve this problem.

Instance Variables

BOOL isPrinting;
BOOL isPageNumbersEnabled;
BOOL isRowNumbersEnabled;
BOOL isSelectedRowsOnly;
BOOL isGridLinesOn;
BOOL isForceDrawColor;
id tableView
id columnList;
id headerTextCell;
id pageNumberCell;
id rowNumberHeaderCell;
id rowNumberCell;
char pageNumSepChar;
char rowNumberHeaderTitle[51];
NXRect pageFrame;
NXRect theRect;
NXCoord rowHeight;
NXCoord pageHeight;
NXCoord pageAdvanceOffset;
NXCoord pageNumberHeight;
NXCoord rowNumberedWidth;
NXSize headerTextCellSize;
NXSize pageNumberCellSize;
NXSize rowNumberHeaderCellSize;;
NXColor gridColor;
NXColor backgroundColor;
NXColor rowNumbersBackColor;
int maxColumns;
int maxRows;
int maxRowsPerPage;
int pagesPerRow;
int startingPageNumber;
int startingRowNumber;

isPrinting	Tells drawself: to only draw if printing.

isPageNumbersEnabled	Page numbering flag.

isRowNumbersEnabled	Row numbering flag.

isSelectedRowsOnly	Print selected rows only flag.

isGridLinesOn	Print grid lines flag.

isForceDrawColor	Always try to render color flag.

tableView	The DBTableView to be printed.

columnList	List object of DBTableView columns.

headerTextCell	TextFieldCell for column headers.

pageNumberCell	TextFieldCell for page numbers.

rowNumberHeaderCell	TextFieldCell for row number column headers.

rowNumberCell	TextFieldCell for row numbers.

pageNumSepChar	Separator for compound page numbers.

rowNumberHeaderTitle[51]	Row number columns header title string.

pageFrame	Size of page.

theRect	Size of main draw rectangle.

rowHeight	Height of a row.

pageHeight	Height of a page.

pageAdvanceOffset	Length to advance draw point to next page.

pageNumberHeight	Height of a page number.

rowNumberedWidth	Width of row number field.

headerTextCellSize	Initial size of the column header Cell.

pageNumberCellSize	Initial size of the page number Cell.

rowNumberHeaderCellSize	Initial size of the row number column header Cell.

gridColor	Grid color.

backgroundColor	Background color of page.

rowNumbersBackColor	Background color of row numbers

maxColumns	Number of columns in the DBTableView.

maxRows	Number of rows ro be printed.

maxRowsPerPage	Number of rows which will fit on one page.

pagesPerRow	Number of compound pages per row.

startingPageNumber	Number to print on first page.

startingRowNumber	Number to print on first row.

Method Types

Initializing and freeing	± initFrame:
	± free

DBTableView access	± setTableView:
	± tableView

Printing	± printPSCode:
		
Page Numbering	± setPageNumbersEnabled:
	± isPageNumbersEnabled
	± setStartingPageNumber:
	± startingPageNumber
	± setPageNumberSeparator:
	± pageNumberSeparator

Row Numbering	± setRowNumbersEnabled:
	± isRowNumbersEnabled
	± setStartingRowNumber:
	± startingRowNumber
	± setRowNumbersTitle:
	± rowNumbersTitle
	
Grid Lines	± setGridLinesOn:
	± isGridLinesOn

Column Header Bezeling	± setColumnHeadersBezeled:
	± isColumnHeadersBezeled

Selection	± setSelectedRowsOnly:
	± isSelectedRowsOnly

Setting Colors	- setForceDrawColor:
	± isForceDrawColor
	± setColumnHeadersTextColor:
	± columnHeadersTextColor
	± setColumnHeadersBackColor:
	± columnHeadersBackColor
	± setRowNumbersTextColor:
	± rowNumbersTextColor
	± setRowNumbersBackColor:
	± rowNumbersBackColor
	± setGridLinesColor:
	± gridLinesColor
	± setPageNumberColor:
	± pageNumberColor
	± setBackgroundColor:
	± backgroundColor

Archiving	- read:
- write:

Instance Methods

backgroundColor
± (NXColor)backgroundColor

Returns the color used for printing the background.

See also:  - setBackgroundColor:

columnHeadersBackColor
± (NXColor)columnHeadersBackColor

Returns the color used for printing the column headers background.

See also:  - setColumnHeadersBackColor:

columnHeadersTextColor
± (NXColor)columnHeadersTextColor

Returns the color used for printing the column headers text.

See also:  - setColumnHeadersTextColor:

free
- free

Frees the instance variables, the DBTableViewPrinter it manages, and itself.  

gridLinesColor
± (NXColor)gridLinesColor

Returns the color used for printing grid lines.

See also:  - setGridLinesColor:

initFrame:
- initFrame:(const NXRect *)frameRect

Initializes the DBTableViewPrinter, which must be a newly allocated instance.  The DBTableViewPrinter's frame rectangle is made equivalent to that pointed to by frameRect.  This method is the designated initializer for the DBTableViewPrinter class.  Returns self.

isColumnHeadersBezeled
± (BOOL)isColumnHeadersBezeled

Returns whether or not the DBTableViewPrinter will print column headers with bezeled borders.

See also:  - setSelectedRowsOnly:

isForceDrawColor
± (BOOL)isForceDrawColor

Returns whether DBTableViewPrinter will render for a color device regardless of the chosen device.

See also:  ± setForceDrawColor:

isGridLinesOn
± (BOOL)isGridLinesOn

Returns whether the printing of grid lines is enabled.

See also:  - setGridLinesOn:

isPageNumbersEnabled
± (BOOL)isPageNumbersEnabled

Returns whether the printing of page numbers is enabled.

See also:  - setPageNumbersEnabled:

isRowNumbersEnabled
± (BOOL)isRowNumbersEnabled

Returns whether the printing of row numbers is enabled.

See also:  - setRowNumbersEnabled:

isSelectedRowsOnly
± (BOOL)isSelectedRowsOnly

Returns whether the printing of only selected rows is enabled.

See also:  - setSelectedRowsOnly:

pageNumberColor
± (NXColor)pageNumberColor

Returns the color used for printing page numbers.

See also:  - setPageNumberColor:

pageNumberSeparator
± pageNumberSeparator

Returns the character used to separate page numbers on compound pages.

See also:  - setPageNumbersEnabled:, ± setPageNumberSeparator:

printPSCode:
- printPSCode:sender

This method prints the DBTableView set by setTableView:.  It acts just like View's definition of printPSCode:.

See also:  - setTableView:, ± printPSCode: (View)

read:
- read:(NXTypedStream *)stream

Unarchives a DBTableViewPrinter instance from stream.

rowNumbersBackColor
± (NXColor)rowNumbersBackColor

Returns the color used for printing the row numbers background.

See also:  - setRowNumbersBackColor:

rowNumbersTextColor
± (NXColor)rowNumbersTextColor

Returns the color used for printing the row numbers text.

See also:  - setRowNumbersTextColor:

rowNumbersTitle:
± (char *)rowNumbersTitle

Returns a pointer to the row numbers column header string.

See also:  - setRowNumbersEnabled:, ± setRowNumbersTitle:

setBackgroundColor:
± setBackgroundColor:(NXColor)color

Sets the color of the background to color.  The default is NX_COLORWHITE.  Returns self.

See also:  - backgroundColor

setColumnHeadersBackColor:
± setColumnHeadersBackColor:(NXColor)color

Sets the color of the column headers background to color.  The default is NX_COLORDKGRAY.  Returns self.

See also:  - columnHeadersBackColor

setColumnHeadersBezeled:
± setColumnHeadersBezeled:(BOOL)toggle

If toggle is YES, DBTableViewPrinter will print column headers with bezeled borders.  The default is NO.  Returns self.

See also:  - isColumnHeadersBezeled

setColumnHeadersTextColor:
± setColumnHeadersTextColor:(NXColor)color

Sets the color of the column headers text to color.  The default is NX_COLORWHITE.  Returns self.

See also:  - columnHeadersTextColor

setForceDrawColor:
± setForceDrawColor:(BOOL)toggle

If toggle is YES, DBTableViewPrinter will always render output for a color device, regardless of the device.  The default is NO, meaning that if a B & W printer is chosen, DBTableViewPrinter will convert to gray scale.  Returns self.

See also:  - isForceDrawColor

setGridLinesColor:
± setGridLinesColor:(NXColor)color

Sets the color of the grid lines to color.  The default is NX_COLORBLACK.  Returns self.

See also:  - gridLinesColor, ± setGridLinesOn:

setGridLinesOn:
± setGridLinesOn:(BOOL)toggle

If toggle is YES, DBTableViewPrinter will print grid lines between rows and columns.  The default is NO.  Returns self.

See also:  - isGridLinesOn

setPageNumberColor:
± setPageNumberColor:(NXColor)color

Sets the color of page numbers to color.  The default is NX_COLORBLACK.  Returns self.

See also:  - pageNumberColor, ± setPageNumbersEnabled:

setPageNumberSeparator:
± setPageNumberSeparator:(char)sepChar

Sets the character used to separate page numbers on compound pages.  The default character is '-'.  For example, if the printing of page numbers is enabled, and the tableView is wider than one printed page, then DBTableViewPrinter will number compund pages like 1-1, 1-2, 1-3, etc.  Returns self.

See also:  - setPageNumbersEnabled:, ± pageNumberSeparator

setPageNumbersEnabled:
± setPageNumbersEnabled:(BOOL)toggle

If toggle is YES, DBTableViewPrinter will print a page number on each printed page.  The default is NO.  Returns self.

See also:  - isPageNumbersEnabled

setRowNumbersEnabled:
± setRowNumbersEnabled:(BOOL)toggle

If toggle is YES, DBTableViewPrinter will print row numbers on each printed page.  The default is NO.  Returns self.

See also:  - isRowNumbersEnabled

setRowNumbersBackColor:
± setRowNumbersBackColor:(NXColor)color

Sets the color of the row numbers background to color.  The default is NX_COLORWHITE.  Returns self.

See also:  - rowNumbersBackColor, ± setRowNumbersEnabled:

setRowNumbersTextColor:
± setRowNumbersTextColor:(NXColor)color

Sets the color of the row numbers text to color.  The default is NX_COLORBLACK.  Returns self.

See also:  - rowNumbersTextColor, ± setRowNumbersEnabled:

setRowNumbersTitle:
± setRowNumbersTitle:(char *)title

Sets the title of the column header for the row numbers to title.  The default is "#".  Returns self.

See also:  - setRowNumbersEnabled:, ± rowNumbersTitle

setSelectedRowsOnly:
± setSelectedRowsOnly:(BOOL)toggle

If toggle is YES, DBTableViewPrinter will print only rows which have been selected in the tableView.  The default is NO, meaning all rows will be printed.  Returns self.

See also:  - isSelectedRowsOnly

setStartingPageNumber:
± setStartingPageNumber:(int)number

If printing of page numbers is enabled, DBTableViewPrinter will begin numbering pages starting with number.  The default is 1.  Returns self.

See also:  - setPageNumbersEnabled:, ± startingPageNumber

setStartingRowNumber:
± setStartingRowNumber:(int)number

If printing of row numbers is enabled, DBTableViewPrinter will begin numbering rows starting with number.  The default is 1.  Returns self.

See also:  - setRowNumbersEnabled:, ± startingRowNumber

setTableView:
± setTableView:tableView

Sets the DBTableView to be printed to tableView.  Returns self.

See also:  - tableView

startingPageNumber
± (int)startingPageNumber

Returns the value used as the printed starting page number.

See also:  - setPageNumbersEnabled:, ± setStartingPageNumber:

startingRowNumber
± (int)startingRowNumber

Returns the value used as the printed starting row number.

See also:  - setRowNumbersEnabled:, ± setStartingRowNumber:

tableView
± tableView

Returns the DBTableView to be printed or nil if not set.

See also:  - setTableView:

write:
- write:(NXTypedStream *)stream

Archives a DBTableViewPrinter instance to stream.