ROOT  6.06/09
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 #include "TClass.h"
17 
19 
20 /** \class TAttPad
21 Manages default Pad attributes. Referenced by TStyle.
22 */
23 
24 ////////////////////////////////////////////////////////////////////////////////
25 /// Constructor.
26 
28 {
29  ResetAttPad();
30 }
31 
32 ////////////////////////////////////////////////////////////////////////////////
33 /// Destructor.
34 
36 {
37 }
38 
39 ////////////////////////////////////////////////////////////////////////////////
40 ///copy function
41 
42 void TAttPad::Copy(TAttPad &attpad) const
43 {
44  attpad.fLeftMargin = fLeftMargin;
45  attpad.fRightMargin = fRightMargin;
47  attpad.fTopMargin = fTopMargin;
48  attpad.fXfile = fXfile;
49  attpad.fYfile = fYfile;
50  attpad.fAfile = fAfile;
51  attpad.fXstat = fXstat;
52  attpad.fYstat = fYstat;
53  attpad.fAstat = fAstat;
61 }
62 
63 ////////////////////////////////////////////////////////////////////////////////
64 /// Print function.
65 
66 void TAttPad::Print(Option_t *) const
67 {
68 }
69 
70 ////////////////////////////////////////////////////////////////////////////////
71 /// Reset pad attributes.
72 
74 {
75  fLeftMargin = gStyle->GetPadLeftMargin();
76  fRightMargin = gStyle->GetPadRightMargin();
77  fBottomMargin = gStyle->GetPadBottomMargin();
78  fTopMargin = gStyle->GetPadTopMargin();
79  fXfile = 2;
80  fYfile = 2;
81  fAfile = 1;
82  fXstat = 0.99;
83  fYstat = 0.99;
84  fAstat = 2;
92 }
93 
94 ////////////////////////////////////////////////////////////////////////////////
95 /// Set Pad bottom margin in fraction of the pad height.
96 
98 {
99  if (margin < 0 || margin >=1) margin = 0.1;
100  if (margin + fTopMargin >= 1) return;
101  fBottomMargin = margin;
102 }
103 
104 ////////////////////////////////////////////////////////////////////////////////
105 /// Set Pad left margin in fraction of the pad width.
106 
108 {
109  if (margin < 0 || margin >=1) margin = 0.1;
110  if (margin + fRightMargin >= 1) return;
111  fLeftMargin = margin;
112 }
113 
114 ////////////////////////////////////////////////////////////////////////////////
115 /// Set Pad right margin in fraction of the pad width.
116 
118 {
119  if (margin < 0 || margin >=1) margin = 0.1;
120  if (margin + fLeftMargin >= 1) return;
121  fRightMargin = margin;
122 }
123 
124 ////////////////////////////////////////////////////////////////////////////////
125 /// Set Pad top margin in fraction of the pad height.
126 
128 {
129  if (margin < 0 || margin >=1) margin = 0.1;
130  if (margin + fBottomMargin >= 1) return;
131  fTopMargin = margin;
132 }
133 
134 ////////////////////////////////////////////////////////////////////////////////
135 /// Set all margins.
136 
137 void TAttPad::SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
138 {
139  SetLeftMargin(left);
140  SetRightMargin(right);
141  SetBottomMargin(bottom);
142  SetTopMargin(top);
143 }
144 
145 ////////////////////////////////////////////////////////////////////////////////
146 /// Stream an object of class TAttPad.
147 
148 void TAttPad::Streamer(TBuffer &R__b)
149 {
150  if (R__b.IsReading()) {
151  UInt_t R__s, R__c;
152  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
153  if (R__v > 2) {
154  R__b.ReadClassBuffer(TAttPad::Class(), this, R__v, R__s, R__c);
155  return;
156  }
157  //====process old versions before automatic schema evolution
158  R__b >> fLeftMargin;
159  R__b >> fRightMargin;
160  R__b >> fBottomMargin;
161  R__b >> fTopMargin;
162  R__b >> fXfile;
163  R__b >> fYfile;
164  R__b >> fAfile;
165  R__b >> fXstat;
166  R__b >> fYstat;
167  R__b >> fAstat;
168  if (R__v > 1) {
169  R__b >> fFrameFillColor;
170  R__b >> fFrameLineColor;
171  R__b >> fFrameFillStyle;
172  R__b >> fFrameLineStyle;
173  R__b >> fFrameLineWidth;
174  R__b >> fFrameBorderSize;
175  R__b >> fFrameBorderMode;
176  }
177  //====end of old versions
178 
179  } else {
180  R__b.WriteClassBuffer(TAttPad::Class(),this);
181  }
182 }
Float_t fXfile
Definition: TAttPad.h:35
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Width_t GetFrameBorderSize() const
Definition: TStyle.h:239
virtual void Copy(TAttPad &attpad) const
copy function
Definition: TAttPad.cxx:42
Style_t fFrameFillStyle
Definition: TAttPad.h:43
Bool_t IsReading() const
Definition: TBuffer.h:81
Float_t fYstat
Definition: TAttPad.h:39
short Version_t
Definition: RtypesCore.h:61
float Float_t
Definition: RtypesCore.h:53
Int_t GetFrameBorderMode() const
Definition: TStyle.h:240
const char Option_t
Definition: RtypesCore.h:62
Float_t fAstat
Definition: TAttPad.h:40
Manages default Pad attributes.
Definition: TAttPad.h:29
Color_t GetFrameFillColor() const
Definition: TStyle.h:234
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
Float_t fBottomMargin
Definition: TAttPad.h:33
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Float_t fYfile
Definition: TAttPad.h:36
Width_t fFrameBorderSize
Definition: TAttPad.h:46
Style_t GetFrameLineStyle() const
Definition: TStyle.h:237
virtual void ResetAttPad(Option_t *option="")
Reset pad attributes.
Definition: TAttPad.cxx:73
Float_t fTopMargin
Definition: TAttPad.h:34
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition: TAttPad.cxx:127
void Class()
Definition: Class.C:29
Float_t GetPadBottomMargin() const
Definition: TStyle.h:220
Style_t GetFrameFillStyle() const
Definition: TStyle.h:236
Float_t fAfile
Definition: TAttPad.h:37
Width_t fFrameLineWidth
Definition: TAttPad.h:45
Float_t fXstat
Definition: TAttPad.h:38
Color_t fFrameLineColor
Definition: TAttPad.h:42
Float_t GetPadRightMargin() const
Definition: TStyle.h:223
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition: TAttPad.cxx:97
Style_t fFrameLineStyle
Definition: TAttPad.h:44
unsigned int UInt_t
Definition: RtypesCore.h:42
Float_t fLeftMargin
Definition: TAttPad.h:31
virtual ~TAttPad()
Destructor.
Definition: TAttPad.cxx:35
Float_t GetPadLeftMargin() const
Definition: TStyle.h:222
virtual void Print(Option_t *option="") const
Print function.
Definition: TAttPad.cxx:66
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
#define ClassImp(name)
Definition: Rtypes.h:279
Int_t fFrameBorderMode
Definition: TAttPad.h:47
virtual void SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
Set all margins.
Definition: TAttPad.cxx:137
Width_t GetFrameLineWidth() const
Definition: TStyle.h:238
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition: TAttPad.cxx:117
Float_t fRightMargin
Definition: TAttPad.h:32
Color_t GetFrameLineColor() const
Definition: TStyle.h:235
Float_t GetPadTopMargin() const
Definition: TStyle.h:221
Color_t fFrameFillColor
Definition: TAttPad.h:41
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition: TAttPad.cxx:107