12#include <TVirtualPad.h>
17 const unsigned short int PadStyle::kBottomMargin = 0;
18 const unsigned short int PadStyle::kLeftMargin = 1;
19 const unsigned short int PadStyle::kTopMargin = 2;
20 const unsigned short int PadStyle::kRightMargin = 3;
21 const unsigned short int PadStyle::kLogx = 4;
22 const unsigned short int PadStyle::kLogy = 5;
23 const unsigned short int PadStyle::kLogz = 6;
24 const unsigned short int PadStyle::kGridx = 7;
25 const unsigned short int PadStyle::kGridy = 8;
26 const unsigned short int PadStyle::kGridz = 9;
28 PadStyle::PadStyle(Double_t x1, Double_t y1, Double_t x2, Double_t y2) {
37 void PadStyle::SetLeftMargin(Float_t val) { SetF(kLeftMargin, val); }
39 void PadStyle::SetTopMargin(Float_t val) { SetF(kTopMargin, val); }
41 void PadStyle::SetRightMargin(Float_t val) { SetF(kRightMargin, val); }
43 void PadStyle::SetLogx(Int_t val) { SetI(kLogx, val); }
45 void PadStyle::SetLogy(Int_t val) { SetI(kLogy, val); }
47 void PadStyle::SetLogz(Int_t val) { SetI(kLogz, val); }
49 void PadStyle::SetGridx(Int_t val) { SetI(kGridx, val); }
51 void PadStyle::SetGridy(Int_t val) { SetI(kGridy, val); }
53 void PadStyle::SetGridz(Int_t val) { SetI(kGridz, val); }
55 Float_t PadStyle::GetBottomMargin()
const {
return GetF(kBottomMargin); }
57 Float_t PadStyle::GetLeftMargin()
const {
return GetF(kLeftMargin); }
59 Float_t PadStyle::GetTopMargin()
const {
return GetF(kTopMargin); }
61 Float_t PadStyle::GetRightMargin()
const {
return GetF(kRightMargin); }
63 Int_t PadStyle::GetLogx(Int_t val)
const {
return GetI(kLogx); }
65 Int_t PadStyle::GetLogy(Int_t val)
const {
return GetI(kLogy); }
67 Int_t PadStyle::GetLogz(Int_t val)
const {
return GetI(kLogz); }
69 Int_t PadStyle::GetGridx(Int_t val)
const {
return GetI(kGridx); }
71 Int_t PadStyle::GetGridy(Int_t val)
const {
return GetI(kGridy); }
73 Int_t PadStyle::GetGridz(Int_t val)
const {
return GetI(kGridz); }
75 PadStyle::PadStyle() {}
77 void PadStyle::Apply(TVirtualPad* obj) {
79 if (
Find(kBottomMargin)) obj->SetBottomMargin(GetF(kBottomMargin));
80 if (
Find(kLeftMargin)) obj->SetLeftMargin(GetF(kLeftMargin));
81 if (
Find(kTopMargin)) obj->SetTopMargin(GetF(kTopMargin));
82 if (
Find(kRightMargin)) obj->SetRightMargin(GetF(kRightMargin));
83 if (
Find(kLogx)) obj->SetLogx(GetI(kLogx));
84 if (
Find(kLogy)) obj->SetLogy(GetI(kLogy));
85 if (
Find(kLogz)) obj->SetLogz(GetI(kLogz));
86 if (
Find(kGridx)) obj->SetGridx(GetI(kGridx));
87 if (
Find(kGridy)) obj->SetGridy(GetI(kGridy));
90 void PadStyle::ExportToXML(XMLNode* node)
const {
92 if (
Find(kBottomMargin)) node->AddAttrib(
new Hal::XMLAttrib(
"BottomMargin", Form(
"%4.4f", GetF(kBottomMargin))));
93 if (
Find(kLeftMargin)) node->AddAttrib(
new Hal::XMLAttrib(
"LeftMargin", Form(
"%4.4f", GetF(kLeftMargin))));
94 if (
Find(kTopMargin)) node->AddAttrib(
new Hal::XMLAttrib(
"TopMargin", Form(
"%4.4f", GetF(kTopMargin))));
95 if (
Find(kRightMargin)) node->AddAttrib(
new Hal::XMLAttrib(
"RightMargin", Form(
"%4.4f", GetF(kRightMargin))));
99 if (
Find(kGridx)) node->AddAttrib(
new Hal::XMLAttrib(
"Gridx", Form(
"%i", GetI(kGridx))));
100 if (
Find(kGridy)) node->AddAttrib(
new Hal::XMLAttrib(
"Gridy", Form(
"%i", GetI(kGridy))));
101 if (
Find(kGridz)) node->AddAttrib(
new Hal::XMLAttrib(
"Gridz", Form(
"%i", GetI(kGridz))));
104 void PadStyle::ImportFromXML(XMLNode* node) {
106 if (
auto atr = node->GetAttrib(
"BottomMargin")) {
107 float x = atr->GetValue().Atof();
110 if (
auto atr = node->GetAttrib(
"LeftMargin")) {
111 float x = atr->GetValue().Atof();
114 if (
auto atr = node->GetAttrib(
"TopMargin")) {
115 float x = atr->GetValue().Atof();
118 if (
auto atr = node->GetAttrib(
"RightMargin")) {
119 float x = atr->GetValue().Atof();
122 if (
auto atr = node->GetAttrib(
"Logx")) {
123 int x = atr->GetValue().Atoi();
126 if (
auto atr = node->GetAttrib(
"Logy")) {
127 int x = atr->GetValue().Atoi();
130 if (
auto atr = node->GetAttrib(
"Logz")) {
131 int x = atr->GetValue().Atoi();
134 if (
auto atr = node->GetAttrib(
"Gridx")) {
135 int x = atr->GetValue().Atoi();
138 if (
auto atr = node->GetAttrib(
"Gridy")) {
139 int x = atr->GetValue().Atoi();
142 if (
auto atr = node->GetAttrib(
"Gridz")) {
143 int x = atr->GetValue().Atoi();
void SetBottomMargin(Float_t val)
Bool_t Find(Int_t bit) const