pcanvas.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:7k
- /*
- * pcanvas.h
- *
- * Printer canvas.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: pcanvas.h,v $
- * Revision 1.16 1999/03/10 03:49:52 robertj
- * More documentation adjustments.
- *
- * Revision 1.15 1999/03/09 08:01:49 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.14 1999/02/16 08:08:46 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.13 1998/09/23 06:24:38 robertj
- * Added open source copyright license.
- *
- * Revision 1.12 1998/03/20 03:14:40 robertj
- * Added function to get physical bounds of canvas. Allows to scale drawing.
- *
- * Revision 1.11 1995/06/17 11:12:51 robertj
- * Documentation update.
- *
- * Revision 1.10 1995/03/14 12:41:59 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.9 1994/12/21 11:53:20 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.8 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.7 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.6 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.5 1994/03/07 07:38:19 robertj
- * Major enhancementsacross the board.
- *
- * Revision 1.4 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.3 1993/08/21 01:50:33 robertj
- * Made Clone() function optional, default will assert if called.
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PPRINTCANVAS
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A canvas that will go to a printer. Outputing to a printer consists of
- drawing to an area that represents a printed page. The application then
- completes each page and creates a new blank page to be drawn to.
- *********************************** NOTE ***********************************
- On Some platforms, canvases are a limited resource. Do NOT create and leave
- them around for long periods. As soon as it is not required till the next
- user event, destroy it!
- ****************************************************************************
- */
- class PPrintCanvas : public PCanvas
- {
- PCLASSINFO(PPrintCanvas, PCanvas);
- public:
- /**Create a canvas that will go to the default printer device using its
- default printer setup.
- */
- PPrintCanvas(
- const PString & job
- /**Arbitrary name to identify to print job on some platforms, eg an
- identifier in the print queue for MS-Windows.
- */
- );
- /**Create a canvas that will go to the specified printer device using its
- default printer setup.
- */
- PPrintCanvas(
- const PString & job,
- /**Arbitrary name to identify to print job on some platforms, eg an
- identifier in the print queue for MS-Windows.
- */
- const PString & printer,
- /**Printer type name for printing to, eg "Postscript". The possible
- values for this parameter are platform dependent and would rarely be
- set explicitly by the application.
- */
- const PString & device
- /**Output device or queue for printer, eg "LPT1" for MS-Windows or
- "PS_LASER" for Unix. The possible values for this parameter are
- platform dependent and would rarely be set explicitly by the
- application.
- */
- );
- /**Create a canvas that will go to the specified printer device using the
- specified printer setup.
- */
- PPrintCanvas(
- const PString & job,
- /**Arbitrary name to identify to print job on some platforms, eg an
- identifier in the print queue for MS-Windows.
- */
- const PPrintInfo & info
- /**Printer specification describing all optional information on the
- selected printer. This would typically be obtained via the
- Ref{PPrintJobDialog} class.
- */
- );
- /** Destroy the printer canvas, freing all resource used. */
- virtual ~PPrintCanvas();
- /**@name New functions for class */
- /**Begin output to a new page. This will close and queue the current page
- and provide a clean new page for further drawing operations.
-
- @return
- TRUE if previous page was successfully queued and the new page is ready
- to be drawn to.
- */
- BOOL NewPage();
- /**Set the drawable area of the printer page. This can limit the amount of
- the page specified in the printer setup that is actually used for the
- printing. This can be usefull for output code that scales to the
- Ref{GetDrawingBounds()} function, but it is not desired that it scale
- to the full page size.
- */
- void SetDrawingBounds(
- const PRect & bounds /// New bounds for canvas.
- );
- /**Get the current printer setup information for the print canvas.
-
- @return
- reference to the current print info.
- */
- const PPrintInfo & GetPrintInfo() const;
- /**This allows the print parameters to be changed in mid job. Note that
- this can only occur between pages, so there is an implicit
- Ref{NewPage()} call in this function.
-
- Not all items in the PPrintInfo can be changed in the middle of the
- print job, eg changing the printer type from "Postscript" to "HPPCL".
- These changes are ignored by the ChangePrintInfo() function.
- */
- void ChangePrintInfo(
- const PPrintInfo & info /// New print information.
- );
- protected:
- // New functions for class
- void Construct();
- // Internal function for common constructor code.
- /**@name Member fields */
- /**Arbitrary name to identify to print job on some platforms, eg an
- identifier in the print queue for MS-Windows.
- */
- PString jobName;
- /**Printer specification describing all optional information on the
- selected printer. This would typically be obtained via the
- Ref{PPrintJobDialog} class.
- */
- PPrintInfo printInfo;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////