home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IRECT_
- #define _IRECT_
- /*******************************************************************************
- * FILE NAME: irect.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the classes: *
- * IRectangle *
- * *
- * COPYRIGHT: *
- * IBM Open Class Library *
- * (C) Copyright International Business Machines Corporation 1992, 1996 *
- * Licensed Material - Program-Property of IBM - All Rights Reserved. *
- * US Government Users Restricted Rights - Use, duplication, or disclosure *
- * restricted by GSA ADP Schedule Contract with IBM Corp. *
- * *
- *******************************************************************************/
-
- #include <ibase.hpp>
- #include <ipoint.hpp>
-
- #pragma pack(4)
-
- struct _RECTL;
- struct tagRECT;
-
-
- class IRectangle : public IBase {
- typedef IBase
- Inherited;
- public:
- /*------------------------------ Related Types -------------------------------*/
- typedef IPair::Coord Coord;
-
- /*------------------------------- Constructors -------------------------------*/
- IRectangle ( );
-
- IRectangle ( const IPoint& point1,
- const IPoint& point2 );
-
- IRectangle ( const IPoint& point,
- const ISize& size );
-
- IRectangle ( Coord point1X,
- Coord point1Y,
- Coord point2X,
- Coord point2Y );
-
- IRectangle ( const struct _RECTL& rectl);
- IRectangle ( const struct tagRECT& rect);
-
- IRectangle ( Coord width,
- Coord height );
- IRectangle ( const IPair& pair );
-
- /*-------------------------------- Points ------------------------------------*/
- IPoint
- minXMinY ( ) const,
- minXCenterY ( ) const,
- minXMaxY ( ) const,
- centerXMinY ( ) const,
- centerXCenterY ( ) const,
- centerXMaxY ( ) const,
- maxXMinY ( ) const,
- maxXCenterY ( ) const,
- maxXMaxY ( ) const;
-
-
- /*-------------------------------- Dimensions --------------------------------*/
- ISize
- size ( ) const;
-
- Coord
- area ( ) const,
- height ( ) const,
- minX ( ) const,
- minY ( ) const,
- maxX ( ) const,
- maxY ( ) const,
- width ( ) const;
-
- /*-------------------------------- Conversions -------------------------------*/
- struct _RECTL
- asRECTL ( ) const;
-
- IString
- asString ( ) const,
- asDebugInfo ( ) const;
-
- /*------------------------------- Comparisons --------------------------------*/
- Boolean
- operator == ( const IRectangle& rectangle ) const,
- operator != ( const IRectangle& rectangle ) const;
-
- /*-------------------------- Manipulation Operators --------------------------*/
- IRectangle
- operator & ( const IRectangle& rectangle ) const,
- &operator &= ( const IRectangle& rectangle ),
- operator | ( const IRectangle& rectangle ) const,
- &operator |= ( const IRectangle& rectangle );
-
- /*------------------------------- Manipulation -------------------------------*/
- IRectangle
- ¢erAt ( const IPoint& point ),
- centeredAt ( const IPoint& point ) const,
- &expandBy ( const IPair& pair ),
- &expandBy ( Coord coord ),
- expandedBy ( const IPair& pair ) const,
- expandedBy ( Coord coord ) const,
- &moveBy ( const IPair& pair ),
- movedBy ( const IPair& pair ) const,
- &moveTo ( const IPoint& point ),
- movedTo ( const IPoint& point ) const,
- &scaleBy ( const IPair& pair ),
- &scaleBy ( Coord coord ),
- &scaleBy ( double factor ),
- &scaleBy ( double xfactor,
- double yfactor ),
- scaledBy ( const IPair& pair ) const,
- scaledBy ( Coord coord ) const,
- scaledBy ( double factor ) const,
- scaledBy ( double xfactor,
- double yfactor ) const,
- &shrinkBy ( const IPair& pair ),
- &shrinkBy ( Coord coord ),
- shrunkBy ( const IPair& pair ) const,
- shrunkBy ( Coord coord ) const,
- &sizeTo ( const IPair& pair ),
- sizedTo ( const IPair& pair ) const,
- &sizeBy ( const IPair& pair ),
- &sizeBy ( Coord factor ),
- &sizeBy ( double factor ),
- &sizeBy ( double xfactor,
- double yfactor ),
- sizedBy ( const IPair& pair ) const,
- sizedBy ( Coord factor ) const,
- sizedBy ( double factor ) const,
- sizedBy ( double xfactor,
- double yfactor ) const;
-
- /*--------------------------------- Testing ----------------------------------*/
- Boolean
- contains ( const IPoint& point ) const,
- contains ( const IRectangle& rectangle ) const,
- intersects ( const IRectangle& rectangle ) const;
-
- /*--------------------------------- Synonyms ---------------------------------*/
- IPoint
- bottomLeft ( ) const,
- bottomCenter ( ) const,
- bottomRight ( ) const,
- center ( ) const,
- leftCenter ( ) const,
- rightCenter ( ) const,
- topLeft ( ) const,
- topCenter ( ) const,
- topRight ( ) const;
-
- Coord
- bottom ( ) const,
- left ( ) const,
- right ( ) const,
- top ( ) const;
-
- /*----------------------------- Stream operators -----------------------------*/
- friend ostream
- &operator << ( ostream& stream,
- const IRectangle& rectangle );
-
- protected:
- /*------------------------------ Implementation ------------------------------*/
- IRectangle
- &validate ( );
-
- private:
- /*--------------------------------- Private ----------------------------------*/
- IPoint
- origin,
- corner;
- }; // class IRectangle
-
- #pragma pack()
-
- #include <irect.inl>
-
- #endif /* _IRECT_ */
-