#ifndef CINSTALL_RECTCC_H #define CINSTALL_RECTCC_H /* * Copyright (c) 2001,2002, Gary R. Van Sickle. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * A copy of the GNU General Public License can be found at * http://www.gnu.org/ * * Written by Gary R. Van Sickle * */ #include struct RECTPP : public RECT { int width() const { return right - left; }; int height() const { return bottom - top; }; RECTPP& operator=(const RECT & r) { right = r.right; left = r.left; top = r.top; bottom = r.bottom; return *this; }; void offset(int x, int y) { // Move the whole rect by [x,y] left += x; right += x; top += y; bottom += y; }; POINT center() const { // Return the center point of the rect. POINT retval; retval.x = (left + right)/2; retval.y = (top + bottom)/2; return retval; } }; #endif // CINSTALL_RECTCC_H