Logo ROOT   6.12/07
Reference Guide
TVirtualPadEditor.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id: TVirtualPadEditor.cxx,v 1.0 2003/11/25
2 // Author: Ilka Antcheva 25/11/03
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 /** \class TVirtualPadEditor
12 \ingroup Base
13 
14 Abstract base class used by ROOT graphics editor
15 */
16 
17 #include "TROOT.h"
18 #include "TVirtualPadEditor.h"
19 #include "TPluginManager.h"
20 #include "TEnv.h"
21 #include "TVirtualPad.h"
22 
25 
27 
28 ////////////////////////////////////////////////////////////////////////////////
29 /// Virtual editor ctor.
30 
32 {
33 }
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 /// Virtual editor dtor.
37 
39 {
40 }
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 /// Static function returning a pointer to a new pad editor.
44 /// This pointer can be adopted by a TCanvas (i.e. TRootCanvas)
45 /// when it embeds the editor.
46 
48 {
50  if (fgEditorName.Length() == 0)
51  fgEditorName = gEnv->GetValue("Root.PadEditor","Ged");
52  h = gROOT->GetPluginManager()->FindHandler("TVirtualPadEditor",
53  fgEditorName);
54  if (h) {
55  if (h->LoadPlugin() == -1)
56  return 0;
57  return (TVirtualPadEditor*) h->ExecPlugin(1, gPad ? gPad->GetCanvas() : 0);
58  }
59 
60  return 0;
61 }
62 
63 ////////////////////////////////////////////////////////////////////////////////
64 /// Returns the type of the default pad editor. Static method.
65 
67 {
68  return fgEditorName;
69 }
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Returns the pad editor dialog. Static method.
73 
75 {
76  if (!fgPadEditor && load)
78 
79  return fgPadEditor;
80 }
81 
82 ////////////////////////////////////////////////////////////////////////////////
83 /// Set type of default pad editor. Static method.
84 
86 {
87  if (fgEditorName == name) return;
88  delete fgPadEditor;
89  fgPadEditor = 0;
91 }
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 /// Show the global pad editor. Static method.
95 
97 {
98  if (!fgPadEditor) {
99  GetPadEditor();
100  if (!fgPadEditor) return;
102  }
103  fgPadEditor->Show();
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// Hide the pad editor. Static method.
108 
110 {
111  if (fgPadEditor)
112  fgPadEditor->Hide();
113 }
114 
115 ////////////////////////////////////////////////////////////////////////////////
116 /// Close the global pad editor. Static method.
117 
119 {
120  if (!fgPadEditor) return;
121 
122  delete fgPadEditor;
123  fgPadEditor = 0;
124 }
125 
126 ////////////////////////////////////////////////////////////////////////////////
127 /// Update fill attributes via the pad editor
128 
130 {
131  ShowEditor();
132 
133  if (fgPadEditor)
134  fgPadEditor->FillAttributes(color, style);
135 }
136 
137 ////////////////////////////////////////////////////////////////////////////////
138 /// Update text attributes via the pad editor
139 
141  Int_t col, Int_t font, Float_t tsize)
142 {
143  ShowEditor();
144 
145  if (fgPadEditor)
146  fgPadEditor->TextAttributes(align, angle, col, font, tsize);
147 }
148 
149 ////////////////////////////////////////////////////////////////////////////////
150 /// Update line attributes via the pad editor
151 
153  Int_t width)
154 {
155  ShowEditor();
156 
157  if (fgPadEditor)
158  fgPadEditor->LineAttributes(color, style, width);
159 }
160 
161 ////////////////////////////////////////////////////////////////////////////////
162 /// Update marker attributes via the pad editor
163 
165  Float_t msize)
166 {
167  ShowEditor();
168 
169  if (fgPadEditor)
170  fgPadEditor->MarkerAttributes(color, style, msize);
171 }
static void SetPadEditorName(const char *name)
Set type of default pad editor. Static method.
float Float_t
Definition: RtypesCore.h:53
virtual void Hide()
static TVirtualPadEditor * LoadEditor()
Static function returning a pointer to a new pad editor.
TH1 * h
Definition: legend2.C:5
static void UpdateTextAttributes(Int_t align, Float_t angle, Int_t col, Int_t font, Float_t tsize)
Update text attributes via the pad editor.
#define gROOT
Definition: TROOT.h:402
Int_t LoadPlugin()
Load the plugin library for this handler.
Basic string class.
Definition: TString.h:125
TVirtualPadEditor()
Virtual editor ctor.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void MarkerAttributes(Int_t, Int_t, Float_t)
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
virtual void TextAttributes(Int_t, Float_t, Int_t, Int_t, Float_t)
virtual void Show()
virtual ~TVirtualPadEditor()
Virtual editor dtor.
static TString fgEditorName
static void HideEditor()
Hide the pad editor. Static method.
static TVirtualPadEditor * fgPadEditor
Long_t ExecPlugin(int nargs, const T &... params)
static void ShowEditor()
Show the global pad editor. Static method.
Ssiz_t Length() const
Definition: TString.h:386
static void UpdateFillAttributes(Int_t col, Int_t sty)
Update fill attributes via the pad editor.
static void UpdateLineAttributes(Int_t col, Int_t sty, Int_t width)
Update line attributes via the pad editor.
static const char * GetEditorName()
Returns the type of the default pad editor. Static method.
static void UpdateMarkerAttributes(Int_t col, Int_t sty, Float_t msiz)
Update marker attributes via the pad editor.
#define ClassImp(name)
Definition: Rtypes.h:359
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
TCanvas * style()
Definition: style.C:1
Abstract base class used by ROOT graphics editor.
virtual void FillAttributes(Int_t, Int_t)
virtual void LineAttributes(Int_t, Int_t, Int_t)
#define gPad
Definition: TVirtualPad.h:285
static void Terminate()
Close the global pad editor. Static method.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
virtual void SetGlobal(Bool_t)