Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
23Manages default Pad attributes. Referenced by TStyle.
24*/
25
26////////////////////////////////////////////////////////////////////////////////
27/// Constructor.
28
30{
32}
33
34////////////////////////////////////////////////////////////////////////////////
35/// Destructor.
36
38{
39}
40
41////////////////////////////////////////////////////////////////////////////////
42///copy function
43
44void TAttPad::Copy(TAttPad &attpad) const
45{
46 attpad.fLeftMargin = fLeftMargin;
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
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
139void 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
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}
short Version_t
Definition RtypesCore.h:65
float Float_t
Definition RtypesCore.h:57
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
R__EXTERN TStyle * gStyle
Definition TStyle.h:414
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:99
virtual void Print(Option_t *option="") const
Print function.
Definition TAttPad.cxx:68
virtual ~TAttPad()
Destructor.
Definition TAttPad.cxx:37
virtual void ResetAttPad(Option_t *option="")
Reset pad attributes.
Definition TAttPad.cxx:75
TAttPad()
Constructor.
Definition TAttPad.cxx:29
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:109
virtual void Copy(TAttPad &attpad) const
copy function
Definition TAttPad.cxx:44
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:119
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:129
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:139
static TClass * Class()
virtual void Streamer(TBuffer &)
Stream an object of class TAttPad.
Definition TAttPad.cxx:150
Buffer base class used for serializing objects.
Definition TBuffer.h:43
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
Definition TBuffer.h:86
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Color_t GetFrameLineColor() const
Definition TStyle.h:218
Float_t GetPadRightMargin() const
Definition TStyle.h:206
Style_t GetFrameFillStyle() const
Definition TStyle.h:219
Float_t GetPadLeftMargin() const
Definition TStyle.h:205
Width_t GetFrameBorderSize() const
Definition TStyle.h:222
Float_t GetPadBottomMargin() const
Definition TStyle.h:203
Style_t GetFrameLineStyle() const
Definition TStyle.h:220
Int_t GetFrameBorderMode() const
Definition TStyle.h:223
Float_t GetPadTopMargin() const
Definition TStyle.h:204
Width_t GetFrameLineWidth() const
Definition TStyle.h:221
Color_t GetFrameFillColor() const
Definition TStyle.h:217