00001 // wg_point.cpp 00002 // 00003 // CPoint class implementation 00004 // 00005 // 00006 // Copyright (c) 2002-2004 Rob Wiskow 00007 // rob-dev@boxedchaos.com 00008 // 00009 // This library is free software; you can redistribute it and/or 00010 // modify it under the terms of the GNU Lesser General Public 00011 // License as published by the Free Software Foundation; either 00012 // version 2.1 of the License, or (at your option) any later version. 00013 // 00014 // This library is distributed in the hope that it will be useful, 00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 // Lesser General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU Lesser General Public 00020 // License along with this library; if not, write to the Free Software 00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 // 00023 00024 00025 #include "wgui_include_config.h" 00026 #include "wg_point.h" 00027 00028 00029 namespace wGui 00030 { 00031 00032 // CPoint class 00033 00034 // add the points 00035 CPoint CPoint::operator+(const CPoint& p) const 00036 { 00037 CPoint result; 00038 result.SetX(m_XPos + p.XPos()); 00039 result.SetY(m_YPos + p.YPos()); 00040 00041 return result; 00042 } 00043 00044 00045 // subtract the points 00046 CPoint CPoint::operator-(const CPoint& p) const 00047 { 00048 CPoint result; 00049 result.SetX(m_XPos - p.XPos()); 00050 result.SetY(m_YPos - p.YPos()); 00051 00052 return result; 00053 } 00054 00055 00056 // assignment operator 00057 CPoint CPoint::operator=(const CPoint& p) 00058 { 00059 m_XPos = p.XPos(); 00060 m_YPos = p.YPos(); 00061 00062 return *this; 00063 } 00064 00065 } 00066