![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * S i z e C l a s s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1994,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXSize.h,v 1.3 2002/01/18 22:42:54 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXSIZE_H 00025 #define FXSIZE_H 00026 00027 00028 /// Size 00029 class FXAPI FXSize { 00030 public: 00031 FXshort w; 00032 FXshort h; 00033 public: 00034 00035 /// Constructors 00036 FXSize(){ } 00037 FXSize(const FXSize& s):w(s.w),h(s.h){ } 00038 FXSize(FXshort ww,FXshort hh):w(ww),h(hh){ } 00039 00040 /// Equality 00041 friend FXAPI FXbool operator==(const FXSize& s,const FXSize& t){ return s.w==t.w && s.h==t.h; } 00042 friend FXAPI FXbool operator!=(const FXSize& s,const FXSize& t){ return s.w!=t.w || s.h!=t.h; } 00043 00044 /// Assignment 00045 FXSize& operator=(const FXSize& s){ w=s.w; h=s.h; return *this; } 00046 00047 /// Assignment operators 00048 FXSize& operator+=(const FXSize& s){ w+=s.w; h+=s.h; return *this; } 00049 FXSize& operator-=(const FXSize& s){ w-=s.w; h-=s.h; return *this; } 00050 FXSize& operator*=(FXshort c){ w*=c; h*=c; return *this; } 00051 FXSize& operator/=(FXshort c){ w/=c; h/=c; return *this; } 00052 00053 /// Negation 00054 FXSize operator-(){ return FXSize(-w,-h); } 00055 00056 /// Other operators 00057 friend FXAPI FXSize operator+(const FXSize& s,const FXSize& t){ return FXSize(s.w+t.w,s.h+t.h); } 00058 friend FXAPI FXSize operator-(const FXSize& s,const FXSize& t){ return FXSize(s.w-t.w,s.h-t.h); } 00059 friend FXAPI FXSize operator*(const FXSize& s,FXshort c){ return FXSize(s.w*c,s.h*c); } 00060 friend FXAPI FXSize operator*(FXshort c,const FXSize& s){ return FXSize(c*s.w,c*s.h); } 00061 friend FXAPI FXSize operator/(const FXSize& s,FXshort c){ return FXSize(s.w/c,s.h/c); } 00062 friend FXAPI FXSize operator/(FXshort c,const FXSize& s){ return FXSize(c/s.w,c/s.h); } 00063 00064 /// Save object to a stream 00065 friend FXAPI FXStream& operator<<(FXStream& store,const FXSize& s); 00066 00067 /// Load object from a stream 00068 friend FXAPI FXStream& operator>>(FXStream& store,FXSize& s); 00069 }; 00070 00071 00072 #endif