TAttPad.cxx

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TAttPad.cxx 26441 2008-11-25 06:13:58Z brun $
00002 // Author: Rene Brun   04/01/95
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 #include "Strlen.h"
00013 #include "TAttPad.h"
00014 #include "TBuffer.h"
00015 #include "TStyle.h"
00016 #include "TClass.h"
00017 
00018 ClassImp(TAttPad)
00019 
00020 //______________________________________________________________________________
00021 //
00022 //  Manages default Pad attributes. Referenced by TStyle.
00023 //
00024 
00025 //______________________________________________________________________________
00026 TAttPad::TAttPad()
00027 {
00028    //constructor
00029    ResetAttPad();
00030 }
00031 
00032 //______________________________________________________________________________
00033 TAttPad::~TAttPad()
00034 {
00035    //destructor
00036 }
00037 
00038 //______________________________________________________________________________
00039 void TAttPad::Copy(TAttPad &attpad) const
00040 {
00041    //copy function
00042    attpad.fLeftMargin   = fLeftMargin;
00043    attpad.fRightMargin  = fRightMargin;
00044    attpad.fBottomMargin = fBottomMargin;
00045    attpad.fTopMargin    = fTopMargin;
00046    attpad.fXfile   = fXfile;
00047    attpad.fYfile   = fYfile;
00048    attpad.fAfile   = fAfile;
00049    attpad.fXstat   = fXstat;
00050    attpad.fYstat   = fYstat;
00051    attpad.fAstat   = fAstat;
00052    attpad.fFrameFillColor = fFrameFillColor;
00053    attpad.fFrameFillStyle = fFrameFillStyle;
00054    attpad.fFrameLineColor = fFrameLineColor;
00055    attpad.fFrameLineStyle = fFrameLineStyle;
00056    attpad.fFrameLineWidth = fFrameLineWidth;
00057    attpad.fFrameBorderSize= fFrameBorderSize;
00058    attpad.fFrameBorderMode= fFrameBorderMode;
00059 }
00060 
00061 //______________________________________________________________________________
00062 void TAttPad::Print(Option_t *) const
00063 {
00064    //print function
00065 }
00066 
00067 //______________________________________________________________________________
00068 void TAttPad::ResetAttPad(Option_t *)
00069 {
00070    //reset pad attributes
00071    fLeftMargin   = gStyle->GetPadLeftMargin();
00072    fRightMargin  = gStyle->GetPadRightMargin();
00073    fBottomMargin = gStyle->GetPadBottomMargin();
00074    fTopMargin    = gStyle->GetPadTopMargin();
00075    fXfile  = 2;
00076    fYfile  = 2;
00077    fAfile  = 1;
00078    fXstat  = 0.99;
00079    fYstat  = 0.99;
00080    fAstat  = 2;
00081    fFrameLineColor = gStyle->GetFrameLineColor();
00082    fFrameFillColor = gStyle->GetFrameFillColor();
00083    fFrameFillStyle = gStyle->GetFrameFillStyle();
00084    fFrameLineStyle = gStyle->GetFrameLineStyle();
00085    fFrameLineWidth = gStyle->GetFrameLineWidth();
00086    fFrameBorderSize= gStyle->GetFrameBorderSize();
00087    fFrameBorderMode= gStyle->GetFrameBorderMode();
00088 }
00089 
00090 //______________________________________________________________________________
00091 void TAttPad::SetBottomMargin(Float_t margin)
00092 {
00093 //*-*-*-*-*-*-*-*-*Set Pad bottom margin in fraction of the pad height*-*-*-*
00094 //*-*              ===================================================
00095    if (margin < 0 || margin >=1) margin = 0.1;
00096    if (margin + fTopMargin >= 1) return;
00097    fBottomMargin = margin;
00098 }
00099 
00100 //______________________________________________________________________________
00101 void TAttPad::SetLeftMargin(Float_t margin)
00102 {
00103 //*-*-*-*-*-*-*-*-*Set Pad left margin in fraction of the pad width*-*-*-*-*
00104 //*-*              ================================================
00105    if (margin < 0 || margin >=1) margin = 0.1;
00106    if (margin + fRightMargin >= 1) return;
00107    fLeftMargin = margin;
00108 }
00109 
00110 //______________________________________________________________________________
00111 void TAttPad::SetRightMargin(Float_t margin)
00112 {
00113 //*-*-*-*-*-*-*-*-*Set Pad right margin in fraction of the pad width*-*-*-*-*
00114 //*-*              =================================================
00115    if (margin < 0 || margin >=1) margin = 0.1;
00116    if (margin + fLeftMargin >= 1) return;
00117    fRightMargin = margin;
00118 }
00119 
00120 //______________________________________________________________________________
00121 void TAttPad::SetTopMargin(Float_t margin)
00122 {
00123 //*-*-*-*-*-*-*-*-*Set Pad top margin in fraction of the pad height*-*-*-*-*
00124 //*-*              ================================================
00125    if (margin < 0 || margin >=1) margin = 0.1;
00126    if (margin + fBottomMargin >= 1) return;
00127    fTopMargin = margin;
00128 }
00129 
00130 //______________________________________________________________________________
00131 void TAttPad::SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
00132 {
00133 //*-*-*-*-*-*-*-*-*Set all margins
00134 
00135    SetLeftMargin(left);
00136    SetRightMargin(right);
00137    SetBottomMargin(bottom);
00138    SetTopMargin(top);
00139 }
00140 
00141 //______________________________________________________________________________
00142 void TAttPad::Streamer(TBuffer &R__b)
00143 {
00144    // Stream an object of class TAttPad.
00145 
00146    if (R__b.IsReading()) {
00147       UInt_t R__s, R__c;
00148       Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
00149       if (R__v > 2) {
00150          R__b.ReadClassBuffer(TAttPad::Class(), this, R__v, R__s, R__c);
00151          return;
00152       }
00153       //====process old versions before automatic schema evolution
00154       R__b >> fLeftMargin;
00155       R__b >> fRightMargin;
00156       R__b >> fBottomMargin;
00157       R__b >> fTopMargin;
00158       R__b >> fXfile;
00159       R__b >> fYfile;
00160       R__b >> fAfile;
00161       R__b >> fXstat;
00162       R__b >> fYstat;
00163       R__b >> fAstat;
00164       if (R__v > 1) {
00165          R__b >> fFrameFillColor;
00166          R__b >> fFrameLineColor;
00167          R__b >> fFrameFillStyle;
00168          R__b >> fFrameLineStyle;
00169          R__b >> fFrameLineWidth;
00170          R__b >> fFrameBorderSize;
00171          R__b >> fFrameBorderMode;
00172       }
00173       //====end of old versions
00174       
00175    } else {
00176       R__b.WriteClassBuffer(TAttPad::Class(),this);
00177    }
00178 }

Generated on Tue Jul 5 14:11:19 2011 for ROOT_528-00b_version by  doxygen 1.5.1