#include "TROOT.h"
#include "TDialogCanvas.h"
#include "TGroupButton.h"
#include "TText.h"
#include "TStyle.h"
ClassImp(TDialogCanvas)
TDialogCanvas::TDialogCanvas() : TCanvas()
{
fRefObject = 0;
fRefPad = 0;
}
TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
: TCanvas(name,title,-ww,wh)
{
SetFillColor(36);
fRefObject = 0;
fRefPad = 0;
}
TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, UInt_t ww, UInt_t wh)
: TCanvas(name,title,-wtopx,wtopy,ww,wh)
{
SetFillColor(36);
fRefObject = 0;
fRefPad = 0;
}
TDialogCanvas::~TDialogCanvas()
{
}
void TDialogCanvas::Apply(const char *action)
{
if (!fRefPad) return;
SetCursor(kWatch);
TIter next(fPrimitives);
TObject *refobj = fRefObject;
TObject *obj;
TGroupButton *button;
if (!strcmp(action,"gStyle")) fRefObject = gStyle;
while ((obj = next())) {
if (obj->InheritsFrom(TGroupButton::Class())) {
button = (TGroupButton*)obj;
if (button->GetBorderMode() < 0) button->ExecuteAction();
}
}
fRefObject = refobj;
if (!gROOT->GetSelectedPad()) return;
gROOT->GetSelectedPad()->Modified();
gROOT->GetSelectedPad()->Update();
}
void TDialogCanvas::BuildStandardButtons()
{
TGroupButton *apply = new TGroupButton("APPLY","Apply","",.05,.01,.3,.09);
apply->SetTextSize(0.55);
apply->SetBorderSize(3);
apply->SetFillColor(44);
apply->Draw();
apply = new TGroupButton("APPLY","gStyle","",.375,.01,.625,.09);
apply->SetTextSize(0.55);
apply->SetBorderSize(3);
apply->SetFillColor(44);
apply->Draw();
apply = new TGroupButton("APPLY","Close","",.70,.01,.95,.09);
apply->SetTextSize(0.55);
apply->SetBorderSize(3);
apply->SetFillColor(44);
apply->Draw();
}
void TDialogCanvas::Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
{
TPad::Range(x1,y1,x2,y2);
}
void TDialogCanvas::RecursiveRemove(TObject *obj)
{
TPad::RecursiveRemove(obj);
if (fRefObject == obj) fRefObject = 0;
if (fRefPad == obj) fRefPad = 0;
}