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
66{
67 if (!fRefPad) return;
69
70 TIter next(fPrimitives);
72 TObject *obj;
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 }
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
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:375
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetCursor
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char y1
char name[80]
Definition TGX11.cxx:110
#define gROOT
Definition TROOT.h:411
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:38
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition TAttText.h:49
void Draw(Option_t *option="") override
Draw this button with its current attributes.
Definition TButton.cxx:145
The Canvas class.
Definition TCanvas.h:23
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()
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:543
void SetBorderSize(Short_t bordersize) override
Definition TPad.h:327
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:5453
void RecursiveRemove(TObject *obj) override
Recursively remove object from a pad and its sub-pads.
Definition TPad.cxx:5511
TList * fPrimitives
->List of primitives (subpads)
Definition TPad.h:107