TDialogCanvas.cxx

Go to the documentation of this file.
00001 // @(#)root/gpad:$Id: TDialogCanvas.cxx 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Rene Brun   03/07/96
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
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 //*-*   A DialogCanvas is a canvas specialized to set attributes.
00024 //*-*   It contains, in general, TGroupButton objects.
00025 //*-*   When the APPLY button is executed, the actions corresponding
00026 //*-*   to the active buttons are executed via the Interpreter.
00027 //*-*
00028 //*-*  See examples in TAttLineCanvas, TAttFillCanvas, TAttTextCanvas, TAttMarkerCanvas
00029 
00030 //______________________________________________________________________________
00031 TDialogCanvas::TDialogCanvas() : TCanvas()
00032 {
00033 //*-*-*-*-*-*-*-*-*-*-*-*DialogCanvas default constructor*-*-*-*-*-*-*-*-*-*-*
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 //*-*-*-*-*-*-*-*-*-*-*-*DialogCanvas constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
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 //*-*-*-*-*-*-*-*-*-*-*-*DialogCanvas constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
00055 //*-*                    ========================
00056 
00057    SetFillColor(36);
00058    fRefObject = 0;
00059    fRefPad    = 0;
00060 }
00061 
00062 //______________________________________________________________________________
00063 TDialogCanvas::~TDialogCanvas()
00064 {
00065 //*-*-*-*-*-*-*-*-*-*-*DialogCanvas default destructor*-*-*-*-*-*-*-*-*-*-*-*
00066 //*-*                  ===============================
00067 }
00068 
00069 //______________________________________________________________________________
00070 void TDialogCanvas::Apply(const char *action)
00071 {
00072 //*-*-*-*-*-*-*-*-*Called when the APPLY button is executed*-*-*-*-*-*-*-*-*-*-*
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 //*-*-*-*-*-*-*-*-*Create APPLY, gStyle and CLOSE buttons*-*-*-*-*-*-*-*-*-*-*
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 //*-*-*-*-*-*-*-*-*-*-*Set world coordinate system for the pad*-*-*-*-*-*-*
00125 //*-*                  =======================================
00126 
00127    TPad::Range(x1,y1,x2,y2);
00128 }
00129 
00130 //______________________________________________________________________________
00131 void TDialogCanvas::RecursiveRemove(TObject *obj)
00132 {
00133 //*-*-*-*-*-*-*-*Recursively remove object from a pad and its subpads*-*-*-*-*
00134 //*-*            ====================================================
00135 
00136    TPad::RecursiveRemove(obj);
00137    if (fRefObject == obj) fRefObject = 0;
00138    if (fRefPad    == obj) fRefPad    = 0;
00139 }

Generated on Tue Jul 5 14:14:07 2011 for ROOT_528-00b_version by  doxygen 1.5.1