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
18
19/** \class TDialogCanvas
20\ingroup gpad
21
22A canvas specialized to set attributes.
23
24It contains, in general, TGroupButton objects.
25When the APPLY button is executed, the actions corresponding
26to the active buttons are executed via the Interpreter.
27
28See examples in TAttLineCanvas, TAttFillCanvas, TAttTextCanvas, TAttMarkerCanvas
29*/
30
31////////////////////////////////////////////////////////////////////////////////
32/// DialogCanvas default constructor
33
35{
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// DialogCanvas constructor
40
41TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t ww, Int_t wh)
42 : TCanvas(name,title,-ww,wh)
43{
44 SetFillColor(36);
45}
46
47////////////////////////////////////////////////////////////////////////////////
48/// DialogCanvas constructor
49
50TDialogCanvas::TDialogCanvas(const char *name, const char *title, Int_t wtopx, Int_t wtopy, UInt_t ww, UInt_t wh)
51 : TCanvas(name,title,-wtopx,wtopy,ww,wh)
52{
53 SetFillColor(36);
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// DialogCanvas default destructor
58
60{
61}
62
63////////////////////////////////////////////////////////////////////////////////
64/// Called when the APPLY button is executed
65
66void TDialogCanvas::Apply(const char *action)
67{
68 if (!fRefPad) return;
70
71 TIter next(fPrimitives);
72 TObject *refobj = fRefObject;
73 TObject *obj;
75 if (!strcmp(action,"gStyle")) fRefObject = gStyle;
76
77 while ((obj = next())) {
79 button = (TGroupButton*)obj;
80 if (button->GetBorderMode() < 0) button->ExecuteAction();
81 }
82 }
83 fRefObject = refobj;
84 if (!gROOT->GetSelectedPad()) return;
85 gROOT->GetSelectedPad()->Modified();
86 gROOT->GetSelectedPad()->Update();
87}
88
89
90////////////////////////////////////////////////////////////////////////////////
91/// Create APPLY, gStyle and CLOSE buttons
92
94{
95 TGroupButton *apply = new TGroupButton("APPLY","Apply","",.05,.01,.3,.09);
96 apply->SetTextSize(0.55);
97 apply->SetBorderSize(3);
98 apply->SetFillColor(44);
99 apply->Draw();
100
101 apply = new TGroupButton("APPLY","gStyle","",.375,.01,.625,.09);
102 apply->SetTextSize(0.55);
103 apply->SetBorderSize(3);
104 apply->SetFillColor(44);
105 apply->Draw();
106
107 apply = new TGroupButton("APPLY","Close","",.70,.01,.95,.09);
108 apply->SetTextSize(0.55);
109 apply->SetBorderSize(3);
110 apply->SetFillColor(44);
111 apply->Draw();
112}
113
114
115////////////////////////////////////////////////////////////////////////////////
116/// Set world coordinate system for the pad
117
119{
121}
122
123
124////////////////////////////////////////////////////////////////////////////////
125/// Recursively remove object from a pad and its sub-pads
126
128{
130 if (fRefObject == obj) fRefObject = nullptr;
131 if (fRefPad == obj) fRefPad = nullptr;
132}
@ kWatch
Definition GuiTypes.h:375
#define ClassImp(name)
Definition Rtypes.h:382
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:406
R__EXTERN TStyle * gStyle
Definition TStyle.h:436
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition TAttText.h:47
void Draw(Option_t *option="") override
Draw this button with its current attributes.
Definition TButton.cxx:139
The Canvas class.
Definition TCanvas.h:23
A canvas specialized to set attributes.
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:542
void SetBorderSize(Short_t bordersize) override
Definition TPad.h:326
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:5331
void RecursiveRemove(TObject *obj) override
Recursively remove object from a pad and its sub-pads.
Definition TPad.cxx:5389
TList * fPrimitives
->List of primitives (subpads)
Definition TPad.h:107