haiku/headers/os/interface/Point.h
Axel Dörfler 70fa61adbb * Removed the _IMPEXP* stuff from the headers Ingo clearly identified as ours.
* Removed storage/Alias.h as that stuff isn't even available on BeOS.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21576 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-06 10:35:17 +00:00

88 lines
1.1 KiB
C++

/*
* Copyright 2001-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Frans van Nispen
*/
#ifndef _POINT_H
#define _POINT_H
#include <BeBuild.h>
#include <SupportDefs.h>
class BRect;
class BPoint {
public:
float x;
float y;
BPoint();
BPoint(float X, float Y);
BPoint(const BPoint &p);
BPoint &operator=(const BPoint &p);
void Set(float X, float Y);
void ConstrainTo(BRect r);
void PrintToStream() const;
BPoint operator-() const;
BPoint operator+(const BPoint &p) const;
BPoint operator-(const BPoint &p) const;
BPoint& operator+=(const BPoint &p);
BPoint& operator-=(const BPoint &p);
bool operator!=(const BPoint &p) const;
bool operator==(const BPoint &p) const;
};
extern const BPoint B_ORIGIN;
// returns (0,0)
inline
BPoint::BPoint()
{
x = y = 0;
}
inline
BPoint::BPoint(float X, float Y)
{
x = X;
y = Y;
}
inline
BPoint::BPoint(const BPoint& pt)
{
x = pt.x;
y = pt.y;
}
inline BPoint &
BPoint::operator=(const BPoint& from)
{
x = from.x;
y = from.y;
return *this;
}
inline void
BPoint::Set(float X, float Y)
{
x = X;
y = Y;
}
#endif // _POINT_H