1    	/* @(#)root/base:$Id$ */
2    	
3    	/*************************************************************************
4    	 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
5    	 * All rights reserved.                                                  *
6    	 *                                                                       *
7    	 * For the licensing terms see $ROOTSYS/LICENSE.                         *
8    	 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
9    	 *************************************************************************/
10   	
11   	#ifndef ROOT_TPoint
12   	#define ROOT_TPoint
13   	
14   	
15   	//////////////////////////////////////////////////////////////////////////
16   	//                                                                      //
17   	// TPoint                                                               //
18   	//                                                                      //
19   	// TPoint implements a 2D screen (device) point (see also TPoints).     //
20   	//                                                                      //
21   	// Don't add in dictionary since that will add a virtual table pointer  //
22   	// and that will destroy the data layout of an array of TPoint's which  //
23   	// should match the layout of an array of XPoint's (so no extra copying //
24   	// needs to be done in the X11 drawing routines).                       //
25   	//                                                                      //
26   	//////////////////////////////////////////////////////////////////////////
27   	
28   	#ifndef ROOT_Rtypes
29   	#include "Rtypes.h"
30   	#endif
31   	
32   	
33   	class TPoint {
34   	
35   	public:    // for easy access
36   	#if !defined(WIN32) && !defined(G__WIN32)
37   	   SCoord_t    fX;         //X device coordinate
38   	   SCoord_t    fY;         //Y device coordinate
39   	#else
40   	   long        fX;         //X device coordinate
41   	   long        fY;         //Y device coordinate
42   	#endif
43   	
44   	public:
45   	   TPoint() : fX(0), fY(0) { }
46   	   TPoint(SCoord_t xy) : fX(xy), fY(xy) { }
47   	   TPoint(SCoord_t x, SCoord_t y) : fX(x), fY(y) { }
48   	   ~TPoint() { }
49   	   SCoord_t    GetX() const { return (SCoord_t)fX; }
50   	   SCoord_t    GetY() const { return (SCoord_t)fY; }
51   	   void        SetX(SCoord_t x) { fX = x; }
52   	   void        SetY(SCoord_t y) { fY = y; }
53   	
54   	   TPoint& operator=(const TPoint& p) { fX = p.fX; fY = p.fY; return *this; }
55   	   friend bool operator==(const TPoint& p1, const TPoint& p2);
56   	   friend bool operator!=(const TPoint& p1, const TPoint& p2);
57   	};
58   	
59   	inline bool operator==(const TPoint& p1, const TPoint& p2)
60   	{
61   	   return p1.fX == p2.fX && p1.fY == p2.fY;
62   	}
63   	
64   	inline bool operator!=(const TPoint& p1, const TPoint& p2)
65   	{
66   	   return p1.fX != p2.fX || p1.fY != p2.fY;
67   	}
68   	
69   	#endif
70