ROOT logo
// @(#)root/gpad:$Id$
// Author: Rene Brun   03/07/96

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#include "TROOT.h"
#include "TDialogCanvas.h"
#include "TGroupButton.h"
#include "TText.h"
#include "TStyle.h"

ClassImp(TDialogCanvas)

//______________________________________________________________________________
// A DialogCanvas is a canvas specialized to set attributes.
// It contains, in general, TGroupButton objects.
// When the APPLY button is executed, the actions corresponding
// to the active buttons are executed via the Interpreter.
//
// See examples in TAttLineCanvas, TAttFillCanvas, TAttTextCanvas, TAttMarkerCanvas


//______________________________________________________________________________
TDialogCanvas::TDialogCanvas() : TCanvas()
{
   // DialogCanvas default constructor

   fRefObject = 0;
   fRefPad    = 0;
}


//_____________________________________________________________________________
TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
             : TCanvas(name,title,-ww,wh)
{
   // DialogCanvas constructor

   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)
{
   // DialogCanvas constructor
   
   SetFillColor(36);
   fRefObject = 0;
   fRefPad    = 0;
}


//______________________________________________________________________________
TDialogCanvas::~TDialogCanvas()
{
   // DialogCanvas default destructor
}


//______________________________________________________________________________
void TDialogCanvas::Apply(const char *action)
{
   // Called when the APPLY button is executed

   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()
{
   // Create APPLY, gStyle and CLOSE buttons

   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)
{
   // Set world coordinate system for the pad

   TPad::Range(x1,y1,x2,y2);
}


//______________________________________________________________________________
void TDialogCanvas::RecursiveRemove(TObject *obj)
{
   // Recursively remove object from a pad and its subpads

   TPad::RecursiveRemove(obj);
   if (fRefObject == obj) fRefObject = 0;
   if (fRefPad    == obj) fRefPad    = 0;
}
 TDialogCanvas.cxx:1
 TDialogCanvas.cxx:2
 TDialogCanvas.cxx:3
 TDialogCanvas.cxx:4
 TDialogCanvas.cxx:5
 TDialogCanvas.cxx:6
 TDialogCanvas.cxx:7
 TDialogCanvas.cxx:8
 TDialogCanvas.cxx:9
 TDialogCanvas.cxx:10
 TDialogCanvas.cxx:11
 TDialogCanvas.cxx:12
 TDialogCanvas.cxx:13
 TDialogCanvas.cxx:14
 TDialogCanvas.cxx:15
 TDialogCanvas.cxx:16
 TDialogCanvas.cxx:17
 TDialogCanvas.cxx:18
 TDialogCanvas.cxx:19
 TDialogCanvas.cxx:20
 TDialogCanvas.cxx:21
 TDialogCanvas.cxx:22
 TDialogCanvas.cxx:23
 TDialogCanvas.cxx:24
 TDialogCanvas.cxx:25
 TDialogCanvas.cxx:26
 TDialogCanvas.cxx:27
 TDialogCanvas.cxx:28
 TDialogCanvas.cxx:29
 TDialogCanvas.cxx:30
 TDialogCanvas.cxx:31
 TDialogCanvas.cxx:32
 TDialogCanvas.cxx:33
 TDialogCanvas.cxx:34
 TDialogCanvas.cxx:35
 TDialogCanvas.cxx:36
 TDialogCanvas.cxx:37
 TDialogCanvas.cxx:38
 TDialogCanvas.cxx:39
 TDialogCanvas.cxx:40
 TDialogCanvas.cxx:41
 TDialogCanvas.cxx:42
 TDialogCanvas.cxx:43
 TDialogCanvas.cxx:44
 TDialogCanvas.cxx:45
 TDialogCanvas.cxx:46
 TDialogCanvas.cxx:47
 TDialogCanvas.cxx:48
 TDialogCanvas.cxx:49
 TDialogCanvas.cxx:50
 TDialogCanvas.cxx:51
 TDialogCanvas.cxx:52
 TDialogCanvas.cxx:53
 TDialogCanvas.cxx:54
 TDialogCanvas.cxx:55
 TDialogCanvas.cxx:56
 TDialogCanvas.cxx:57
 TDialogCanvas.cxx:58
 TDialogCanvas.cxx:59
 TDialogCanvas.cxx:60
 TDialogCanvas.cxx:61
 TDialogCanvas.cxx:62
 TDialogCanvas.cxx:63
 TDialogCanvas.cxx:64
 TDialogCanvas.cxx:65
 TDialogCanvas.cxx:66
 TDialogCanvas.cxx:67
 TDialogCanvas.cxx:68
 TDialogCanvas.cxx:69
 TDialogCanvas.cxx:70
 TDialogCanvas.cxx:71
 TDialogCanvas.cxx:72
 TDialogCanvas.cxx:73
 TDialogCanvas.cxx:74
 TDialogCanvas.cxx:75
 TDialogCanvas.cxx:76
 TDialogCanvas.cxx:77
 TDialogCanvas.cxx:78
 TDialogCanvas.cxx:79
 TDialogCanvas.cxx:80
 TDialogCanvas.cxx:81
 TDialogCanvas.cxx:82
 TDialogCanvas.cxx:83
 TDialogCanvas.cxx:84
 TDialogCanvas.cxx:85
 TDialogCanvas.cxx:86
 TDialogCanvas.cxx:87
 TDialogCanvas.cxx:88
 TDialogCanvas.cxx:89
 TDialogCanvas.cxx:90
 TDialogCanvas.cxx:91
 TDialogCanvas.cxx:92
 TDialogCanvas.cxx:93
 TDialogCanvas.cxx:94
 TDialogCanvas.cxx:95
 TDialogCanvas.cxx:96
 TDialogCanvas.cxx:97
 TDialogCanvas.cxx:98
 TDialogCanvas.cxx:99
 TDialogCanvas.cxx:100
 TDialogCanvas.cxx:101
 TDialogCanvas.cxx:102
 TDialogCanvas.cxx:103
 TDialogCanvas.cxx:104
 TDialogCanvas.cxx:105
 TDialogCanvas.cxx:106
 TDialogCanvas.cxx:107
 TDialogCanvas.cxx:108
 TDialogCanvas.cxx:109
 TDialogCanvas.cxx:110
 TDialogCanvas.cxx:111
 TDialogCanvas.cxx:112
 TDialogCanvas.cxx:113
 TDialogCanvas.cxx:114
 TDialogCanvas.cxx:115
 TDialogCanvas.cxx:116
 TDialogCanvas.cxx:117
 TDialogCanvas.cxx:118
 TDialogCanvas.cxx:119
 TDialogCanvas.cxx:120
 TDialogCanvas.cxx:121
 TDialogCanvas.cxx:122
 TDialogCanvas.cxx:123
 TDialogCanvas.cxx:124
 TDialogCanvas.cxx:125
 TDialogCanvas.cxx:126
 TDialogCanvas.cxx:127
 TDialogCanvas.cxx:128
 TDialogCanvas.cxx:129
 TDialogCanvas.cxx:130
 TDialogCanvas.cxx:131
 TDialogCanvas.cxx:132
 TDialogCanvas.cxx:133
 TDialogCanvas.cxx:134
 TDialogCanvas.cxx:135
 TDialogCanvas.cxx:136
 TDialogCanvas.cxx:137
 TDialogCanvas.cxx:138
 TDialogCanvas.cxx:139