Logo ROOT   6.16/01
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\ingroup Base
22\ingroup GraphicsAtt
23
24Manages default Pad attributes. Referenced by TStyle.
25*/
26
27////////////////////////////////////////////////////////////////////////////////
28/// Constructor.
29
31{
33}
34
35////////////////////////////////////////////////////////////////////////////////
36/// Destructor.
37
39{
40}
41
42////////////////////////////////////////////////////////////////////////////////
43///copy function
44
45void TAttPad::Copy(TAttPad &attpad) const
46{
47 attpad.fLeftMargin = fLeftMargin;
50 attpad.fTopMargin = fTopMargin;
51 attpad.fXfile = fXfile;
52 attpad.fYfile = fYfile;
53 attpad.fAfile = fAfile;
54 attpad.fXstat = fXstat;
55 attpad.fYstat = fYstat;
56 attpad.fAstat = fAstat;
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Print function.
68
70{
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Reset pad attributes.
75
77{
82 fXfile = 2;
83 fYfile = 2;
84 fAfile = 1;
85 fXstat = 0.99;
86 fYstat = 0.99;
87 fAstat = 2;
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Set Pad bottom margin in fraction of the pad height.
99
101{
102 if (margin < 0 || margin >=1) margin = 0.1;
103 if (margin + fTopMargin >= 1) return;
104 fBottomMargin = margin;
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Set Pad left margin in fraction of the pad width.
109
111{
112 if (margin < 0 || margin >=1) margin = 0.1;
113 if (margin + fRightMargin >= 1) return;
114 fLeftMargin = margin;
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Set Pad right margin in fraction of the pad width.
119
121{
122 if (margin < 0 || margin >=1) margin = 0.1;
123 if (margin + fLeftMargin >= 1) return;
124 fRightMargin = margin;
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Set Pad top margin in fraction of the pad height.
129
131{
132 if (margin < 0 || margin >=1) margin = 0.1;
133 if (margin + fBottomMargin >= 1) return;
134 fTopMargin = margin;
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Set all margins.
139
140void TAttPad::SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
141{
142 SetLeftMargin(left);
143 SetRightMargin(right);
144 SetBottomMargin(bottom);
145 SetTopMargin(top);
146}
147
148////////////////////////////////////////////////////////////////////////////////
149/// Stream an object of class TAttPad.
150
151void TAttPad::Streamer(TBuffer &R__b)
152{
153 if (R__b.IsReading()) {
154 UInt_t R__s, R__c;
155 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
156 if (R__v > 2) {
157 R__b.ReadClassBuffer(TAttPad::Class(), this, R__v, R__s, R__c);
158 return;
159 }
160 //====process old versions before automatic schema evolution
161 R__b >> fLeftMargin;
162 R__b >> fRightMargin;
163 R__b >> fBottomMargin;
164 R__b >> fTopMargin;
165 R__b >> fXfile;
166 R__b >> fYfile;
167 R__b >> fAfile;
168 R__b >> fXstat;
169 R__b >> fYstat;
170 R__b >> fAstat;
171 if (R__v > 1) {
172 R__b >> fFrameFillColor;
173 R__b >> fFrameLineColor;
174 R__b >> fFrameFillStyle;
175 R__b >> fFrameLineStyle;
176 R__b >> fFrameLineWidth;
177 R__b >> fFrameBorderSize;
178 R__b >> fFrameBorderMode;
179 }
180 //====end of old versions
181
182 } else {
183 R__b.WriteClassBuffer(TAttPad::Class(),this);
184 }
185}
void Class()
Definition: Class.C:29
short Version_t
Definition: RtypesCore.h:61
unsigned int UInt_t
Definition: RtypesCore.h:42
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:363
R__EXTERN TStyle * gStyle
Definition: TStyle.h:406
Manages default Pad attributes.
Definition: TAttPad.h:19
Float_t fYstat
Y position where to draw the statistics.
Definition: TAttPad.h:29
Color_t fFrameLineColor
Pad frame line color.
Definition: TAttPad.h:32
Float_t fAstat
Alignment for the statistics.
Definition: TAttPad.h:30
Width_t fFrameLineWidth
Pad frame line width.
Definition: TAttPad.h:35
Float_t fAfile
Alignment for the file name.
Definition: TAttPad.h:27
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
Definition: TAttPad.cxx:100
virtual void Print(Option_t *option="") const
Print function.
Definition: TAttPad.cxx:69
virtual ~TAttPad()
Destructor.
Definition: TAttPad.cxx:38
virtual void ResetAttPad(Option_t *option="")
Reset pad attributes.
Definition: TAttPad.cxx:76
TAttPad()
Constructor.
Definition: TAttPad.cxx:30
Style_t fFrameFillStyle
Pad frame fill style.
Definition: TAttPad.h:33
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
Definition: TAttPad.cxx:110
virtual void Copy(TAttPad &attpad) const
copy function
Definition: TAttPad.cxx:45
Color_t fFrameFillColor
Pad frame fill color.
Definition: TAttPad.h:31
Float_t fXfile
X position where to draw the file name.
Definition: TAttPad.h:25
Float_t fRightMargin
RightMargin.
Definition: TAttPad.h:22
Float_t fXstat
X position where to draw the statistics.
Definition: TAttPad.h:28
Float_t fLeftMargin
LeftMargin.
Definition: TAttPad.h:21
Float_t fTopMargin
TopMargin.
Definition: TAttPad.h:24
Width_t fFrameBorderSize
Pad frame border size.
Definition: TAttPad.h:36
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Definition: TAttPad.cxx:120
Float_t fYfile
Y position where to draw the file name.
Definition: TAttPad.h:26
Style_t fFrameLineStyle
Pad frame line style.
Definition: TAttPad.h:34
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
Definition: TAttPad.cxx:130
Float_t fBottomMargin
BottomMargin.
Definition: TAttPad.h:23
Int_t fFrameBorderMode
Pad frame border mode.
Definition: TAttPad.h:37
virtual void SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
Set all margins.
Definition: TAttPad.cxx:140
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
Bool_t IsReading() const
Definition: TBuffer.h:83
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Color_t GetFrameLineColor() const
Definition: TStyle.h:213
Float_t GetPadRightMargin() const
Definition: TStyle.h:201
Style_t GetFrameFillStyle() const
Definition: TStyle.h:214
Float_t GetPadLeftMargin() const
Definition: TStyle.h:200
Width_t GetFrameBorderSize() const
Definition: TStyle.h:217
Float_t GetPadBottomMargin() const
Definition: TStyle.h:198
Style_t GetFrameLineStyle() const
Definition: TStyle.h:215
Int_t GetFrameBorderMode() const
Definition: TStyle.h:218
Float_t GetPadTopMargin() const
Definition: TStyle.h:199
Width_t GetFrameLineWidth() const
Definition: TStyle.h:216
Color_t GetFrameFillColor() const
Definition: TStyle.h:212