michael@0: /* michael@0: * Copyright (C) 2006 The Android Open Source Project michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #ifndef ANDROID_UI_POINT michael@0: #define ANDROID_UI_POINT michael@0: michael@0: #include michael@0: michael@0: namespace android { michael@0: michael@0: class Point michael@0: { michael@0: public: michael@0: int x; michael@0: int y; michael@0: michael@0: // we don't provide copy-ctor and operator= on purpose michael@0: // because we want the compiler generated versions michael@0: michael@0: // Default constructor doesn't initialize the Point michael@0: inline Point() { michael@0: } michael@0: inline Point(int x, int y) : x(x), y(y) { michael@0: } michael@0: michael@0: inline bool operator == (const Point& rhs) const { michael@0: return (x == rhs.x) && (y == rhs.y); michael@0: } michael@0: inline bool operator != (const Point& rhs) const { michael@0: return !operator == (rhs); michael@0: } michael@0: michael@0: inline bool isOrigin() const { michael@0: return !(x|y); michael@0: } michael@0: michael@0: // operator < defines an order which allows to use points in sorted michael@0: // vectors. michael@0: bool operator < (const Point& rhs) const { michael@0: return y