ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 Abstract base class used by ROOT graphics editor
13 */
14 
15 #include "TROOT.h"
16 #include "TVirtualPadEditor.h"
17 #include "TPluginManager.h"
18 #include "TEnv.h"
19 #include "TVirtualPad.h"
20 
21 TVirtualPadEditor *TVirtualPadEditor::fgPadEditor = 0;
22 TString TVirtualPadEditor::fgEditorName = "";
23 
25 
26 ////////////////////////////////////////////////////////////////////////////////
27 /// Virtual editor ctor.
28 
30 {
31 }
32 
33 ////////////////////////////////////////////////////////////////////////////////
34 /// Virtual editor dtor.
35 
37 {
38 }
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// Static function returning a pointer to a new pad editor.
42 /// This pointer can be adopted by a TCanvas (i.e. TRootCanvas)
43 /// when it embeds the editor.
44 
46 {
48  if (fgEditorName.Length() == 0)
49  fgEditorName = gEnv->GetValue("Root.PadEditor","Ged");
50  h = gROOT->GetPluginManager()->FindHandler("TVirtualPadEditor",
51  fgEditorName);
52  if (h) {
53  if (h->LoadPlugin() == -1)
54  return 0;
55  return (TVirtualPadEditor*) h->ExecPlugin(1, gPad ? gPad->GetCanvas() : 0);
56  }
57 
58  return 0;
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// Returns the type of the default pad editor. Static method.
63 
65 {
66  return fgEditorName;
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Returns the pad editor dialog. Static method.
71 
73 {
74  if (!fgPadEditor && load)
76 
77  return fgPadEditor;
78 }
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 /// Set type of default pad editor. Static method.
82 
84 {
85  if (fgEditorName == name) return;
86  delete fgPadEditor;
87  fgPadEditor = 0;
89 }
90 
91 ////////////////////////////////////////////////////////////////////////////////
92 /// Show the global pad editor. Static method.
93 
95 {
96  if (!fgPadEditor) {
97  GetPadEditor();
98  if (!fgPadEditor) return;
100  }
101  fgPadEditor->Show();
102 }
103 
104 ////////////////////////////////////////////////////////////////////////////////
105 /// Hide the pad editor. Static method.
106 
108 {
109  if (fgPadEditor)
110  fgPadEditor->Hide();
111 }
112 
113 ////////////////////////////////////////////////////////////////////////////////
114 /// Close the global pad editor. Static method.
115 
117 {
118  if (!fgPadEditor) return;
119 
120  delete fgPadEditor;
121  fgPadEditor = 0;
122 }
123 
124 ////////////////////////////////////////////////////////////////////////////////
125 /// Update fill attributes via the pad editor
126 
128 {
129  ShowEditor();
130 
131  if (fgPadEditor)
132  fgPadEditor->FillAttributes(color, style);
133 }
134 
135 ////////////////////////////////////////////////////////////////////////////////
136 /// Update text attributes via the pad editor
137 
139  Int_t col, Int_t font, Float_t tsize)
140 {
141  ShowEditor();
142 
143  if (fgPadEditor)
144  fgPadEditor->TextAttributes(align, angle, col, font, tsize);
145 }
146 
147 ////////////////////////////////////////////////////////////////////////////////
148 /// Update line attributes via the pad editor
149 
151  Int_t width)
152 {
153  ShowEditor();
154 
155  if (fgPadEditor)
156  fgPadEditor->LineAttributes(color, style, width);
157 }
158 
159 ////////////////////////////////////////////////////////////////////////////////
160 /// Update marker attributes via the pad editor
161 
163  Float_t msize)
164 {
165  ShowEditor();
166 
167  if (fgPadEditor)
168  fgPadEditor->MarkerAttributes(color, style, msize);
169 }
static void SetPadEditorName(const char *name)
Set type of default pad editor. Static method.
Ssiz_t Length() const
Definition: TString.h:390
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:344
Int_t LoadPlugin()
Load the plugin library for this handler.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void MarkerAttributes(Int_t, Int_t, Float_t)
ClassImp(TVirtualPadEditor) TVirtualPadEditor
Virtual editor ctor.
Long_t ExecPlugin(int nargs, const T &...params)
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)
void align()
Definition: geodemo.C:1778
virtual void Show()
virtual ~TVirtualPadEditor()
Virtual editor dtor.
static TString fgEditorName
static void HideEditor()
Hide the pad editor. Static method.
static TVirtualPadEditor * fgPadEditor
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:494
static void ShowEditor()
Show the global pad editor. Static method.
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.
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
TCanvas * style()
Definition: style.C:1
Abstract base class used by ROOT graphics editor.
virtual void FillAttributes(Int_t, Int_t)
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void LineAttributes(Int_t, Int_t, Int_t)
#define gPad
Definition: TVirtualPad.h:288
static void Terminate()
Close the global pad editor. Static method.
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetGlobal(Bool_t)