- /*
- * dim.h
- *
- * Coordinate system dimensions.
- *
- * 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: dim.h,v $
- * Revision 1.13 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.12 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.11 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.10 1998/09/23 06:23:21 robertj
- * Added open source copyright license.
- *
- * Revision 1.9 1995/06/04 08:46:20 robertj
- * Added Add component functions.
- *
- * Revision 1.8 1995/03/14 12:41:20 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.7 1994/12/13 11:47:55 robertj
- * Documentation.
- *
- * Revision 1.6 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.5 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * 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/11/20 17:26:28 robertj
- * Added + and _ operators with PPoint classes
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PDIM
- #ifdef __GNUC__
- #pragma interface
- #endif
- class PPoint;
- /**This class represents a size in two dimensions. The pair of values are
- platform dependent and are dependent on the standard type Ref{PDIMENSION}.
- */
- class PDim : public PObject
- {
- PCLASSINFO(PDim, PObject);
- public:
- /**Create a dimensions object with the initial width and height values of
- zero.
- */
- PDim();
- /** Create a dimension object with the initial width and height values. */
- PDim(
- PDIMENSION width, /// Initial width of the dimensions.
- PDIMENSION height /// Initial height of the dimensions.
- );
- /** Create a copy of the specified dimension. */
- PDim(
- const PDim & dim /// Initial dimensions.
- );
- /**@name Overrides from class PObject */
- /**Create a copy of the specified dimensions.
- @return
- a new variable allocated on the heap with the same dimensions.
- */
- virtual PObject * Clone() const;
- /**Determine the relative rank of the two dimensions.
- @return
- #EqualTo# if the two dimensions are the same,
- #LessThan# if the area depicted by the two dimensions
- (width*height) is smaller and #GreaterThan# if the area is
- bigger.
- */
- virtual Comparison Compare(const PObject & obj) const;
- /**@name New function for class */
- /**Get the width dimension.
- @return
- width.
- */
- PDIMENSION Width() const;
- /**Get the height dimension.
- @return
- height.
- */
- PDIMENSION Height() const;
- /** Set the width dimension. */
- void SetWidth(
- PDIMENSION width /// New width for dimensions.
- );
- /** Set the height dimension. */
- void SetHeight(
- PDIMENSION height /// New height for dimensions.
- );
- /** Add a value to the width dimension. */
- void AddWidth(
- PORDINATE dw /// Amount to add to the dimensions.
- );
- /** Add a value to the height dimension. */
- void AddHeight(
- PORDINATE dh /// Amount to add to the dimensions.
- );
- /**Add the value to the dimension and return a third dimension.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- sum dimension.
- */
- PDim operator+(
- const PDim & dim /// Dimension to add.
- ) const;
- PDim operator+(
- const PPoint & pt /// Point to add to the dimension.
- ) const;
- /**Add the value to the dimension.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- reference to original dimension.
- */
- PDim & operator+=(
- const PDim & dim /// Dimension to add.
- );
- PDim & operator+=(
- const PPoint & pt /// Point to add to the dimension.
- );
- /**Subtract the value to the dimension and return a third dimension.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- difference dimension.
- */
- PDim operator-(
- const PDim & dim /// Dimension to subtract.
- ) const;
- PDim operator-(
- const PPoint & pt /// Point to add to the dimension.
- ) const;
- /**Subtract the value to the dimension.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- reference to original dimension.
- */
- PDim & operator-=(
- const PDim & dim /// Dimension to subtract.
- );
- PDim & operator-=(
- const PPoint & pt /// Point to add to the dimension.
- );
- /**Multiple the dimension by the scale factor and return a third dimension.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- product dimension.
- */
- PDim operator*(
- PDIMENSION scale /// Scale factor to apply to dimension
- ) const;
- /**Multiply the dimension by the scale factor.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- reference to original dimension.
- */
- PDim & operator*=(
- PDIMENSION scale /// Scale factor to apply to dimension
- );
- /**Divide the dimension by the scale factor and return a third dimension.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- divided dimension.
- */
- PDim operator/(
- PDIMENSION scale /// Scale factor to apply to dimension
- ) const;
- /**Divide the dimension by the scale factor.
- The operation is performed in cartesian coordinates so each dimension
- is independently dealt with.
- @return
- reference to original dimension.
- */
- PDim & operator/=(
- PDIMENSION scale /// Scale factor to apply to dimension
- );
- protected:
- // Member variables
- PDIMENSION width, height;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////