00001 // @(#)root/gui:$Id: TGDimension.cxx 23115 2008-04-10 13:35:37Z rdm $ 00002 // Author: Fons Rademakers 02/01/98 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 /************************************************************************** 00012 00013 This source is based on Xclass95, a Win95-looking GUI toolkit. 00014 Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza. 00015 00016 Xclass95 is free software; you can redistribute it and/or 00017 modify it under the terms of the GNU Library General Public 00018 License as published by the Free Software Foundation; either 00019 version 2 of the License, or (at your option) any later version. 00020 00021 **************************************************************************/ 00022 00023 ////////////////////////////////////////////////////////////////////////// 00024 // // 00025 // TGDimension, TGPosition, TGLongPosition, TGInsets and TGRectangle // 00026 // // 00027 // Several small geometry classes that implement dimensions // 00028 // (width and height), positions (x and y), insets and rectangles. // 00029 // They are trivial and their members are public. // 00030 // // 00031 ////////////////////////////////////////////////////////////////////////// 00032 00033 #include "TGDimension.h" 00034 #include "TMathBase.h" 00035 00036 ClassImp(TGDimension) 00037 ClassImp(TGPosition) 00038 ClassImp(TGLongPosition) 00039 ClassImp(TGInsets) 00040 ClassImp(TGRectangle) 00041 00042 void TGRectangle::Merge(const TGRectangle &r) 00043 { 00044 // Merge parameters 00045 Int_t max_x = TMath::Max(fX + (Int_t) fW, r.fX + (Int_t) r.fW); 00046 fX = TMath::Min(fX, r.fX); 00047 Int_t max_y = TMath::Max(fY + (Int_t) fH, r.fY + (Int_t) r.fH); 00048 fY = TMath::Min(fY, r.fY); 00049 fW = max_x - fX; 00050 fH = max_y - fY; 00051 }