Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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-2021, 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 "TStyle.h"
16
17
18/** \class TDialogCanvas
19\ingroup gpad
20
21A canvas specialized to set attributes.
22
23It contains, in general, TGroupButton objects.
24When the APPLY button is executed, the actions corresponding
25to the active buttons are executed via the Interpreter.
26
27See examples in TAttLineCanvas, TAttFillCanvas, TAttTextCanvas, TAttMarkerCanvas
28*/
29
30////////////////////////////////////////////////////////////////////////////////
31/// DialogCanvas default constructor
32
36
37////////////////////////////////////////////////////////////////////////////////
38/// DialogCanvas constructor
39
40TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
41 : TCanvas(name,title,-ww,wh)
42{
43 SetFillColor(36);
44}
45
46////////////////////////////////////////////////////////////////////////////////
47/// DialogCanvas constructor
48
49TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, UInt_t ww, UInt_t wh)
50 : TCanvas(name,title,-wtopx,wtopy,ww,wh)
51{
52 SetFillColor(36);
53}
54
55////////////////////////////////////////////////////////////////////////////////
56/// DialogCanvas default destructor
57
61
62////////////////////////////////////////////////////////////////////////////////
63/// Called when the APPLY button is executed
64
65void TDialogCanvas::Apply(const char *action)
66{
67 if (!fRefPad) return;
69
70 TIter next(fPrimitives);
71 TObject *refobj = fRefObject;
72 TObject *obj;
73 TGroupButton *button;
74 if (!strcmp(action,"gStyle")) fRefObject = gStyle;
75
76 while ((obj = next())) {
78 button = (TGroupButton*)obj;
79 if (button->GetBorderMode() < 0) button->ExecuteAction();
80 }
81 }
82 fRefObject = refobj;
83 if (!gROOT->GetSelectedPad()) return;
84 gROOT->GetSelectedPad()->Modified();
85 gROOT->GetSelectedPad()->Update();
86}
87
88
89////////////////////////////////////////////////////////////////////////////////
90/// Create APPLY, gStyle and CLOSE buttons
91
93{
94 TGroupButton *apply = new TGroupButton("APPLY","Apply","",.05,.01,.3,.09);
95 apply->SetTextSize(0.55);
96 apply->SetBorderSize(3);
97 apply->SetFillColor(44);
98 apply->Draw();
99
100 apply = new TGroupButton("APPLY","gStyle","",.375,.01,.625,.09);
101 apply->SetTextSize(0.55);
102 apply->SetBorderSize(3);
103 apply->SetFillColor(44);
104 apply->Draw();
105
106 apply = new TGroupButton("APPLY","Close","",.70,.01,.95,.09);
107 apply->SetTextSize(0.55);
108 apply->SetBorderSize(3);
109 apply->SetFillColor(44);
110 apply->Draw();
111}
112
113
114////////////////////////////////////////////////////////////////////////////////
115/// Set world coordinate system for the pad
116
118{
119 TPad::Range(x1,y1,x2,y2);
120}
121
122
123////////////////////////////////////////////////////////////////////////////////
124/// Recursively remove object from a pad and its sub-pads
125
127{
129 if (fRefObject == obj) fRefObject = nullptr;
130 if (fRefPad == obj) fRefPad = nullptr;
131}
@ kWatch
Definition GuiTypes.h:376
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
char name[80]
Definition TGX11.cxx:148
#define gROOT
Definition TROOT.h:417
externTStyle * gStyle
Definition TStyle.h:442
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition TAttText.h:53
void Draw(Option_t *option="") override
Draw this button with its current attributes.
Definition TButton.cxx:145
TCanvas(const TCanvas &canvas)=delete
void SetCursor(ECursor cursor) override
Set cursor.
Definition TCanvas.cxx:1959
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Set world coordinate system for the pad.
TObject * fRefObject
Pointer to object to set attributes.
void RecursiveRemove(TObject *obj) override
Recursively remove object from a pad and its sub-pads.
TPad * fRefPad
Pad containing object.
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.
~TDialogCanvas() override
DialogCanvas default destructor.
A specialized TButton used in a group of Buttons.
static TClass * Class()
virtual void ExecuteAction()
Execute action of this button.
Mother of all ROOT objects.
Definition TObject.h:42
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:549
Short_t GetBorderMode() const override
Definition TPad.h:199
void SetBorderSize(Short_t bordersize) override
Definition TPad.h:332
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Set world coordinate system for the pad.
Definition TPad.cxx:5344
void RecursiveRemove(TObject *obj) override
Recursively remove object from a pad and its sub-pads.
Definition TPad.cxx:5402
TList * fPrimitives
->List of primitives (subpads)
Definition TPad.h:107