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
17
18/** \class TAttPad
19\ingroup Base
20\ingroup GraphicsAtt
21
22Manages default Pad attributes. Referenced by TStyle.
23*/
24
25////////////////////////////////////////////////////////////////////////////////
26/// Constructor.
27
32
33////////////////////////////////////////////////////////////////////////////////
34/// Destructor.
35
39
40////////////////////////////////////////////////////////////////////////////////
41///copy function
42
43void TAttPad::Copy(TAttPad &attpad) const
44{
45 attpad.fLeftMargin = fLeftMargin;
48 attpad.fTopMargin = fTopMargin;
49 attpad.fXfile = fXfile;
50 attpad.fYfile = fYfile;
51 attpad.fAfile = fAfile;
52 attpad.fXstat = fXstat;
53 attpad.fYstat = fYstat;
54 attpad.fAstat = fAstat;
62}
63
64////////////////////////////////////////////////////////////////////////////////
65/// Print function.
66
68{
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Reset pad attributes.
73
75{
76 fLeftMargin = gStyle->GetPadLeftMargin();
77 fRightMargin = gStyle->GetPadRightMargin();
78 fBottomMargin = gStyle->GetPadBottomMargin();
79 fTopMargin = gStyle->GetPadTopMargin();
80 fXfile = 2;
81 fYfile = 2;
82 fAfile = 1;
83 fXstat = 0.99;
84 fYstat = 0.99;
85 fAstat = 2;
86 fFrameLineColor = gStyle->GetFrameLineColor();
87 fFrameFillColor = gStyle->GetFrameFillColor();
88 fFrameFillStyle = gStyle->GetFrameFillStyle();
89 fFrameLineStyle = gStyle->GetFrameLineStyle();
90 fFrameLineWidth = gStyle->GetFrameLineWidth();
91 fFrameBorderSize= gStyle->GetFrameBorderSize();
92 fFrameBorderMode= gStyle->GetFrameBorderMode();
93}
94
95////////////////////////////////////////////////////////////////////////////////
96/// Set Pad bottom margin in fraction of the pad height.
97
99{
100 if (margin < 0 || margin >=1) margin = 0.1;
101 if (margin + fTopMargin >= 1) return;
102 fBottomMargin = margin;
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Set Pad left margin in fraction of the pad width.
107
109{
110 if (margin < 0 || margin >=1) margin = 0.1;
111 if (margin + fRightMargin >= 1) return;
112 fLeftMargin = margin;
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Set Pad right margin in fraction of the pad width.
117
119{
120 if (margin < 0 || margin >=1) margin = 0.1;
121 if (margin + fLeftMargin >= 1) return;
122 fRightMargin = margin;
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Set Pad top margin in fraction of the pad height.
127
129{
130 if (margin < 0 || margin >=1) margin = 0.1;
131 if (margin + fBottomMargin >= 1) return;
132 fTopMargin = margin;
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// Set all margins.
137
138void TAttPad::SetMargin(Float_t left, Float_t right, Float_t bottom, Float_t top)
139{
140 SetLeftMargin(left);
141 SetRightMargin(right);
142 SetBottomMargin(bottom);
143 SetTopMargin(top);
144}
145
146////////////////////////////////////////////////////////////////////////////////
147/// Stream an object of class TAttPad.
148
150{
151 if (R__b.IsReading()) {
152 UInt_t R__s, R__c;
153 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
154 if (R__v > 2) {
155 R__b.ReadClassBuffer(TAttPad::Class(), this, R__v, R__s, R__c);
156 return;
157 }
158 //====process old versions before automatic schema evolution
159 R__b >> fLeftMargin;
160 R__b >> fRightMargin;
161 R__b >> fBottomMargin;
162 R__b >> fTopMargin;
163 R__b >> fXfile;
164 R__b >> fYfile;
165 R__b >> fAfile;
166 R__b >> fXstat;
167 R__b >> fYstat;
168 R__b >> fAstat;
169 if (R__v > 1) {
170 R__b >> fFrameFillColor;
171 R__b >> fFrameLineColor;
172 R__b >> fFrameFillStyle;
173 R__b >> fFrameLineStyle;
174 R__b >> fFrameLineWidth;
175 R__b >> fFrameBorderSize;
176 R__b >> fFrameBorderMode;
177 }
178 //====end of old versions
179
180 } else {
181 R__b.WriteClassBuffer(TAttPad::Class(),this);
182 }
183}
short Version_t
Class version identifier (short).
Definition RtypesCore.h:79
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
externTStyle * gStyle
Definition TStyle.h:442
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:98
virtual void Print(Option_t *option="") const
Print function.
Definition TAttPad.cxx:67
virtual ~TAttPad()
Destructor.
Definition TAttPad.cxx:36
virtual void ResetAttPad(Option_t *option="")
Reset pad attributes.
Definition TAttPad.cxx:74
TAttPad()
Constructor.
Definition TAttPad.cxx:28
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:108
virtual void Copy(TAttPad &attpad) const
copy function
Definition TAttPad.cxx:43
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:118
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:128
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:138
static TClass * Class()
virtual void Streamer(TBuffer &)
Stream an object of class TAttPad.
Definition TAttPad.cxx:149
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