icanvas.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:6k
- /*
- * icanvas.h
- *
- * Interactor Canvas ancestor class.
- *
- * 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: icanvas.h,v $
- * Revision 1.15 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.14 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.13 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.12 1998/09/23 06:23:46 robertj
- * Added open source copyright license.
- *
- * Revision 1.11 1995/06/17 11:12:38 robertj
- * Documentation update.
- *
- * Revision 1.10 1995/03/14 12:41:30 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.9 1994/12/21 11:53:02 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/15 03:40:36 robertj
- * Added destructor for Mac.
- *
- * Revision 1.4 1994/01/15 03:30:33 robertj
- * Added destructor for use by Mac.
- *
- * Revision 1.3 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PINTERACTORCANVAS
- #ifdef __GNUC__
- #pragma interface
- #endif
- class PInteractor;
- /**A canvas that is attached to an interactor on the screen. This is an
- abstract class with two main descendents. If the application wants to draw
- into the interactor outside of the automatic update mechanism it must use
- Ref{PDrawCanvas}, while the Ref{PInteractor::OnRedraw()} function of an
- interactor receives an instance of the Ref{PRedrawCanvas} class.
- *********************************** 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 PInteractorCanvas : public PCanvas
- {
- PCLASSINFO(PInteractorCanvas, PCanvas);
- public:
- /** Create a canvas associated with an interactor on the screen. */
- PInteractorCanvas(
- PInteractor * theInteractor, /// Interactor canvas is attached to.
- BOOL inPixels
- /**Set the initial canvas coordinates are in screen pixels. The default
- is for the coordinates to be set to one based on the current font for
- the interactor (1/4 the average character widthand 1/8 the height).
- */
- );
- /** Destroy the interactor canvas. */
- ~PInteractorCanvas();
- /**@name Overrides from class PCanvas */
- /**Get the drawable area of the interactor, this would be the dimensions
- of the Ref{PInteractor} class associated with the canvas. A canvas
- associated with a Ref{PScrollable} class, however, could return a
- drawable area much larger than the interactors size.
- @return
- rectangle for the maximum size of the drawable area.
- */
- virtual PRect GetDrawingBounds() const;
- /**@name New functions for class */
- /**Get the interactor that the canvas is attached to.
-
- @return
- pointer to interactor drawn to by the canvas.
- */
- PInteractor * GetInteractor() const;
- /**Scroll the contents of the canvas by the amount specified. The entire
- contents of the interactor are moved. The area "left behind" by the
- move is unchanged. If a rectangle is specified then only that part of
- the canvas contents is scrolled.
- */
- void Scroll(
- const PPoint & amt /// Amount to scroll.
- );
- void Scroll(
- const PPoint & amt, /// Amount to scroll.
- const PRect & rect /// Area of canvas to scroll.
- );
- void Scroll(
- PORDINATE dx, /// Amount to scroll horizontally.
- PORDINATE dy /// Amount to scroll vertically.
- );
- void Scroll(
- PORDINATE dx, /// Amount to scroll horizontally.
- PORDINATE dy, /// Amount to scroll vertically.
- const PRect & rect /// Area of canvas to scroll.
- );
- /**Copy the contents of the srcRect in this canvas to the destination
- canvas at the position specified or area rectangle. If a rectangle is
- specified then the image is stretched or compressed to fit.
- */
- void Copy(
- const PRect & srcRect, /// Area in canvas to copy.
- PCanvas & dst, /// Canvas to copy area to.
- const PPoint & pt /// Position in canvas to copy the area to.
- );
- void Copy(
- const PRect & srcRect, /// Area in canvas to copy.
- PCanvas & dst, /// Canvas to copy area to.
- const PRect & dstRect /// Area in destination canvas to copy the area.
- );
- protected:
- // New functions for class
- void Construct(BOOL inPixels);
- // Common constructor code.
-
- // Member variables
- /** The interactor this canvas is attached to. */
- PInteractor * interactor;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////