GEOS SDK TechDocs|
|
2.2 Supplying the Document's Name
The process object (or whatever object is specified in the
PrintControl
's
PCI_output
field) describes the fax's contents in the method for the imported message
MSG_PRINT_START_PRINTING
. It will receive this message after the user has specified a recipient for the fax. This message is defined:
void MSG_PRINT_START_PRINTING( \ optr printCtrlOD , \ GStateHandle gstate );
There are some things that the handler for this message must do:
GrNewPage()
to generate a form feed. (It should also call
GrNewPage()
between the pages of a multi-page fax, of course.)
PrintControl
MSG_PRINT_CONTROL_PRINTING_COMPLETED
.There are many things that the handler for this message may do. For information about some of them, see thePrinting chapter. (If you read that chapter, you might think it's important that the print job's page range is also determined; this is not important for faxing.)
The following example shows a handler that draws a fax's contents to contain some text and a rectangle:
Code Display 4-4 Handling MSG_PRINT_START_PRINTING when faxing
@method MyProcessClass, MSG_PRINT_START_PRINTING {
/* We draw the contents of the fax. */
GrDrawText(gstate, 20,40, "Good Morning", 0);
GrDrawRect(gstate, 10,30, 110,55);
/* Make sure that our last drawing command is a form-feed */
GrNewPage(gstate, PEC_FORM_FEED);
/* Let the PrintControl know we're done */
@send printCtrlOD::MSG_PRINT_CONTROL_PRINTING_COMPLETED();
}
In the example, we draw the fax's contents with a couple of kernel graphics commands. We might just have easily passed gstate as the graphic state argument to some Visible object's
MSG_VIS_DRAW
message (also passing the
DrawFlag
DF_PRINT).
We also need to tell the
PrintControl
how many pages we're printing. The first page that we draw on is page one. If there is a separate cover page, that will be page zero. To specify how many pages there are to print, we call MSG_PRINT_CONTROL_SET_SELECTED_PAGE_RANGE, and then MSG_PRINT_CONTROL_SET_SELECTED_PAGE_RANGE, passing the number of pages to print as that message's second argument.
It is possible that the fax cover page will appear on the same page on which drawing starts. To find out how much vertical space this cover page will take up on the first page, call the PrintControl with
MSG_PRINT_GET_FIRST_PAGE_OFFSET
; the return value will be the height of the cover page. (To properly follow naming conventions, this message should be called
MSG_PRINT_CONTROL_GET_FIRST_PAGE_OFFSET
; as of this writing it has not yet had its name fixed.)
GEOS SDK TechDocs|
|
2.2 Supplying the Document's Name