Logo ROOT  
Reference Guide
TAttPad.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Rene Brun 04/01/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "Strlen.h"
13 #include "TAttPad.h"
14 #include "TBuffer.h"
15 #include "TStyle.h"
16 
18 
19 /** \class TAttPad
20 \ingroup Base
21 \ingroup GraphicsAtt
22 
23 Manages default Pad attributes. Referenced by TStyle.
24 */
25 
26 ////////////////////////////////////////////////////////////////////////////////
27 /// Constructor.
28 
30 {
31  ResetAttPad();
32 }
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Destructor.
36 
38 {
39 }
40 
41 ////////////////////////////////////////////////////////////////////////////////
42 ///copy function
43 
44 void TAttPad::Copy(TAttPad &attpad) const
45 {
46  attpad.fLeftMargin = fLeftMargin;
47  attpad.fRightMargin = fRightMargin;
49  attpad.fTopMargin = fTopMargin;
50  attpad.fXfile = fXfile;
51  attpad.fYfile = fYfile;
52  attpad.fAfile = fAfile;
53  attpad.fXstat = fXstat;
54  attpad.fYstat = fYstat;
55  attpad.fAstat = fAstat;
63 }
64 
65 ////////////////////////////////////////////////////////////////////////////////
66 /// Print function.
67 
68 void TAttPad::Print(Option_t *) const
69 {
70 }
71 
72 ////////////////////////////////////////////////////////////////////////////////
73 /// Reset pad attributes.
74 
76 {
81  fXfile = 2;
82  fYfile = 2;
83  fAfile = 1;
84  fXstat = 0.99;
85  fYstat = 0.99;
86  fAstat = 2;
94 }
95 
96 ////////////////////////////////////////////////////////////////////////////////
97 /// Set Pad bottom margin in fraction of the pad height.
98 
100 {
101  if (margin < 0 || margin >=1) margin = 0.1;
102  if (margin + fTopMargin >= 1) return;
103  fBottomMargin = margin;
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// Set Pad left margin in fraction of the pad width.
108 
110 {
111  if (margin < 0 || margin >=1) margin = 0.1;
112  if (margin + fRightMargin >= 1) return;
113  fLeftMargin = margin;
114 }
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 /// Set Pad right margin in fraction of the pad width.
118 
120 {
121  if (margin < 0 || margin >=1) margin = 0.1;
122  if (margin + fLeftMargin >= 1) return;
123  fRightMargin = margin;
124 }
125 
126 ////////////////////////////////////////////////////////////////////////////////
127 /// Set Pad top margin in fraction of the pad height.
128 
130 {
131  if (margin < 0 || margin >=1) margin = 0.1;
132  if (margin + fBottomMargin >= 1) return;
133  fTopMargin = margin;
134 }
135 
136 ////////////////////////////////////////////////////////////////////////////////
137 /// Set all margins.
138 
139 void TAttPad::SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
140 {
141  SetLeftMargin(left);
142  SetRightMargin(right);
143  SetBottomMargin(bottom);
144  SetTopMargin(top);
145 }
146 
147 ////////////////////////////////////////////////////////////////////////////////
148 /// Stream an object of class TAttPad.
149 
150 void TAttPad::Streamer(TBuffer &R__b)
151 {
152  if (R__b.IsReading()) {
153  UInt_t R__s, R__c;
154  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
155  if (R__v > 2) {
156  R__b.ReadClassBuffer(TAttPad::Class(), this, R__v, R__s, R__c);
157  return;
158  }
159  //====process old versions before automatic schema evolution
160  R__b >> fLeftMargin;
161  R__b >> fRightMargin;
162  R__b >> fBottomMargin;
163  R__b >> fTopMargin;
164  R__b >> fXfile;
165  R__b >> fYfile;
166  R__b >> fAfile;
167  R__b >> fXstat;
168  R__b >> fYstat;
169  R__b >> fAstat;
170  if (R__v > 1) {
171  R__b >> fFrameFillColor;
172  R__b >> fFrameLineColor;
173  R__b >> fFrameFillStyle;
174  R__b >> fFrameLineStyle;
175  R__b >> fFrameLineWidth;
176  R__b >> fFrameBorderSize;
177  R__b >> fFrameBorderMode;
178  }
179  //====end of old versions
180 
181  } else {
182  R__b.WriteClassBuffer(TAttPad::Class(),this);
183  }
184 }
TAttPad::ResetAttPad
virtual void ResetAttPad(Option_t *option="")
Reset pad attributes.
Definition: TAttPad.cxx:75
TAttPad::fAfile
Float_t fAfile
Alignment for the file name.
Definition: TAttPad.h:33
TAttPad::SetTopMargin
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition: TAttPad.cxx:129
TAttPad
Definition: TAttPad.h:19
TAttPad::fFrameLineColor
Color_t fFrameLineColor
Pad frame line color.
Definition: TAttPad.h:38
Version_t
short Version_t
Definition: RtypesCore.h:65
TStyle::GetFrameLineColor
Color_t GetFrameLineColor() const
Definition: TStyle.h:217
TAttPad::fFrameBorderSize
Width_t fFrameBorderSize
Pad frame border size.
Definition: TAttPad.h:42
TAttPad::fYstat
Float_t fYstat
Y position where to draw the statistics.
Definition: TAttPad.h:35
TStyle::GetFrameFillStyle
Style_t GetFrameFillStyle() const
Definition: TStyle.h:218
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TBuffer::ReadClassBuffer
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
TAttPad::SetMargin
virtual void SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
Set all margins.
Definition: TAttPad.cxx:139
TAttPad::fAstat
Float_t fAstat
Alignment for the statistics.
Definition: TAttPad.h:36
TAttPad::fFrameLineWidth
Width_t fFrameLineWidth
Pad frame line width.
Definition: TAttPad.h:41
Float_t
float Float_t
Definition: RtypesCore.h:57
TStyle::GetFrameBorderMode
Int_t GetFrameBorderMode() const
Definition: TStyle.h:222
TStyle.h
TStyle::GetPadTopMargin
Float_t GetPadTopMargin() const
Definition: TStyle.h:203
Strlen.h
TBuffer
Definition: TBuffer.h:43
TStyle::GetFrameBorderSize
Width_t GetFrameBorderSize() const
Definition: TStyle.h:221
TStyle::GetFrameLineWidth
Width_t GetFrameLineWidth() const
Definition: TStyle.h:220
TAttPad.h
TAttPad::fLeftMargin
Float_t fLeftMargin
LeftMargin.
Definition: TAttPad.h:27
TAttPad::fBottomMargin
Float_t fBottomMargin
BottomMargin.
Definition: TAttPad.h:29
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TAttPad::fRightMargin
Float_t fRightMargin
RightMargin.
Definition: TAttPad.h:28
TStyle::GetFrameFillColor
Color_t GetFrameFillColor() const
Definition: TStyle.h:216
TBuffer.h
TAttPad::fTopMargin
Float_t fTopMargin
TopMargin.
Definition: TAttPad.h:30
TStyle::GetFrameLineStyle
Style_t GetFrameLineStyle() const
Definition: TStyle.h:219
gStyle
R__EXTERN TStyle * gStyle
Definition: TStyle.h:412
TAttPad::SetBottomMargin
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition: TAttPad.cxx:99
TAttPad::Print
virtual void Print(Option_t *option="") const
Print function.
Definition: TAttPad.cxx:68
TAttPad::fXstat
Float_t fXstat
X position where to draw the statistics.
Definition: TAttPad.h:34
TBuffer::WriteClassBuffer
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TAttPad::fFrameBorderMode
Int_t fFrameBorderMode
Pad frame border mode.
Definition: TAttPad.h:43
TAttPad::fFrameFillStyle
Style_t fFrameFillStyle
Pad frame fill style.
Definition: TAttPad.h:39
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TStyle::GetPadLeftMargin
Float_t GetPadLeftMargin() const
Definition: TStyle.h:204
TAttPad::fYfile
Float_t fYfile
Y position where to draw the file name.
Definition: TAttPad.h:32
TAttPad::~TAttPad
virtual ~TAttPad()
Destructor.
Definition: TAttPad.cxx:37
TBuffer::ReadVersion
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
TAttPad::SetLeftMargin
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition: TAttPad.cxx:109
TBuffer::IsReading
Bool_t IsReading() const
Definition: TBuffer.h:86
TStyle::GetPadRightMargin
Float_t GetPadRightMargin() const
Definition: TStyle.h:205
TAttPad::SetRightMargin
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition: TAttPad.cxx:119
TAttPad::Copy
virtual void Copy(TAttPad &attpad) const
copy function
Definition: TAttPad.cxx:44
TAttPad::fFrameLineStyle
Style_t fFrameLineStyle
Pad frame line style.
Definition: TAttPad.h:40
TAttPad::TAttPad
TAttPad()
Constructor.
Definition: TAttPad.cxx:29
TAttPad::fFrameFillColor
Color_t fFrameFillColor
Pad frame fill color.
Definition: TAttPad.h:37
TAttPad::fXfile
Float_t fXfile
X position where to draw the file name.
Definition: TAttPad.h:31
Class
void Class()
Definition: Class.C:29
TStyle::GetPadBottomMargin
Float_t GetPadBottomMargin() const
Definition: TStyle.h:202