00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TROOT.h"
00013 #include "TDialogCanvas.h"
00014 #include "TGroupButton.h"
00015 #include "TText.h"
00016 #include "TStyle.h"
00017
00018 ClassImp(TDialogCanvas)
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 TDialogCanvas::TDialogCanvas() : TCanvas()
00032 {
00033
00034
00035
00036 }
00037
00038
00039 TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
00040 : TCanvas(name,title,-ww,wh)
00041 {
00042
00043
00044
00045 SetFillColor(36);
00046 fRefObject = 0;
00047 fRefPad = 0;
00048 }
00049
00050
00051 TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, UInt_t ww, UInt_t wh)
00052 : TCanvas(name,title,-wtopx,wtopy,ww,wh)
00053 {
00054
00055
00056
00057 SetFillColor(36);
00058 fRefObject = 0;
00059 fRefPad = 0;
00060 }
00061
00062
00063 TDialogCanvas::~TDialogCanvas()
00064 {
00065
00066
00067 }
00068
00069
00070 void TDialogCanvas::Apply(const char *action)
00071 {
00072
00073
00074
00075 if (!fRefPad) return;
00076 SetCursor(kWatch);
00077
00078 TIter next(fPrimitives);
00079 TObject *refobj = fRefObject;
00080 TObject *obj;
00081 TGroupButton *button;
00082 if (!strcmp(action,"gStyle")) fRefObject = gStyle;
00083
00084 while ((obj = next())) {
00085 if (obj->InheritsFrom(TGroupButton::Class())) {
00086 button = (TGroupButton*)obj;
00087 if (button->GetBorderMode() < 0) button->ExecuteAction();
00088 }
00089 }
00090 fRefObject = refobj;
00091 if (!gROOT->GetSelectedPad()) return;
00092 gROOT->GetSelectedPad()->Modified();
00093 gROOT->GetSelectedPad()->Update();
00094 }
00095
00096
00097 void TDialogCanvas::BuildStandardButtons()
00098 {
00099
00100
00101
00102 TGroupButton *apply = new TGroupButton("APPLY","Apply","",.05,.01,.3,.09);
00103 apply->SetTextSize(0.55);
00104 apply->SetBorderSize(3);
00105 apply->SetFillColor(44);
00106 apply->Draw();
00107
00108 apply = new TGroupButton("APPLY","gStyle","",.375,.01,.625,.09);
00109 apply->SetTextSize(0.55);
00110 apply->SetBorderSize(3);
00111 apply->SetFillColor(44);
00112 apply->Draw();
00113
00114 apply = new TGroupButton("APPLY","Close","",.70,.01,.95,.09);
00115 apply->SetTextSize(0.55);
00116 apply->SetBorderSize(3);
00117 apply->SetFillColor(44);
00118 apply->Draw();
00119 }
00120
00121
00122 void TDialogCanvas::Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
00123 {
00124
00125
00126
00127 TPad::Range(x1,y1,x2,y2);
00128 }
00129
00130
00131 void TDialogCanvas::RecursiveRemove(TObject *obj)
00132 {
00133
00134
00135
00136 TPad::RecursiveRemove(obj);
00137 if (fRefObject == obj) fRefObject = 0;
00138 if (fRefPad == obj) fRefPad = 0;
00139 }