Logo ROOT  
Reference Guide
TDialogCanvas.cxx
Go to the documentation of this file.
1// @(#)root/gpad:$Id$
2// Author: Rene Brun 03/07/96
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TROOT.h"
13#include "TDialogCanvas.h"
14#include "TGroupButton.h"
15#include "TText.h"
16#include "TStyle.h"
17
19
20/** \class TDialogCanvas
21\ingroup gpad
22
23A canvas specialized to set attributes.
24
25It contains, in general, TGroupButton objects.
26When the APPLY button is executed, the actions corresponding
27to the active buttons are executed via the Interpreter.
28
29See examples in TAttLineCanvas, TAttFillCanvas, TAttTextCanvas, TAttMarkerCanvas
30*/
31
32////////////////////////////////////////////////////////////////////////////////
33/// DialogCanvas default constructor
34
36{
37 fRefObject = 0;
38 fRefPad = 0;
39}
40
41////////////////////////////////////////////////////////////////////////////////
42/// DialogCanvas constructor
43
44TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
45 : TCanvas(name,title,-ww,wh)
46{
47 SetFillColor(36);
48 fRefObject = 0;
49 fRefPad = 0;
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// DialogCanvas constructor
54
55TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, UInt_t ww, UInt_t wh)
56 : TCanvas(name,title,-wtopx,wtopy,ww,wh)
57{
58 SetFillColor(36);
59 fRefObject = 0;
60 fRefPad = 0;
61}
62
63////////////////////////////////////////////////////////////////////////////////
64/// DialogCanvas default destructor
65
67{
68}
69
70////////////////////////////////////////////////////////////////////////////////
71/// Called when the APPLY button is executed
72
73void TDialogCanvas::Apply(const char *action)
74{
75 if (!fRefPad) return;
77
78 TIter next(fPrimitives);
79 TObject *refobj = fRefObject;
80 TObject *obj;
81 TGroupButton *button;
82 if (!strcmp(action,"gStyle")) fRefObject = gStyle;
83
84 while ((obj = next())) {
86 button = (TGroupButton*)obj;
87 if (button->GetBorderMode() < 0) button->ExecuteAction();
88 }
89 }
90 fRefObject = refobj;
91 if (!gROOT->GetSelectedPad()) return;
92 gROOT->GetSelectedPad()->Modified();
93 gROOT->GetSelectedPad()->Update();
94}
95
96
97////////////////////////////////////////////////////////////////////////////////
98/// Create APPLY, gStyle and CLOSE buttons
99
101{
102 TGroupButton *apply = new TGroupButton("APPLY","Apply","",.05,.01,.3,.09);
103 apply->SetTextSize(0.55);
104 apply->SetBorderSize(3);
105 apply->SetFillColor(44);
106 apply->Draw();
107
108 apply = new TGroupButton("APPLY","gStyle","",.375,.01,.625,.09);
109 apply->SetTextSize(0.55);
110 apply->SetBorderSize(3);
111 apply->SetFillColor(44);
112 apply->Draw();
113
114 apply = new TGroupButton("APPLY","Close","",.70,.01,.95,.09);
115 apply->SetTextSize(0.55);
116 apply->SetBorderSize(3);
117 apply->SetFillColor(44);
118 apply->Draw();
119}
120
121
122////////////////////////////////////////////////////////////////////////////////
123/// Set world coordinate system for the pad
124
126{
127 TPad::Range(x1,y1,x2,y2);
128}
129
130
131////////////////////////////////////////////////////////////////////////////////
132/// Recursively remove object from a pad and its sub-pads
133
135{
137 if (fRefObject == obj) fRefObject = 0;
138 if (fRefPad == obj) fRefPad = 0;
139}
void Class()
Definition: Class.C:29
@ kWatch
Definition: GuiTypes.h:374
static const double x2[5]
static const double x1[5]
double Double_t
Definition: RtypesCore.h:57
#define ClassImp(name)
Definition: Rtypes.h:361
char name[80]
Definition: TGX11.cxx:109
#define gROOT
Definition: TROOT.h:406
R__EXTERN TStyle * gStyle
Definition: TStyle.h:410
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
The Canvas class.
Definition: TCanvas.h:27
virtual void SetCursor(ECursor cursor)
Set cursor.
Definition: TCanvas.cxx:1966
A canvas specialized to set attributes.
Definition: TDialogCanvas.h:19
virtual ~TDialogCanvas()
DialogCanvas default destructor.
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a pad and its sub-pads.
TObject * fRefObject
Pointer to object to set attributes.
Definition: TDialogCanvas.h:26
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
TPad * fRefPad
Pad containing object.
Definition: TDialogCanvas.h:27
virtual void Apply(const char *action="")
Called when the APPLY button is executed.
TDialogCanvas()
DialogCanvas default constructor.
virtual void BuildStandardButtons()
Create APPLY, gStyle and CLOSE buttons.
A specialized TButton used in a group of Buttons.
Definition: TGroupButton.h:18
virtual void ExecuteAction()
Execute action of this button.
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:443
virtual void RecursiveRemove(TObject *obj)
Recursively remove object from a pad and its sub-pads.
Definition: TPad.cxx:5231
TList * fPrimitives
->List of primitives (subpads)
Definition: TPad.h:106
virtual Short_t GetBorderMode() const
Definition: TPad.h:196
virtual void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Set world coordinate system for the pad.
Definition: TPad.cxx:5173