TVirtualPadEditor.cxx

Go to the documentation of this file.
00001 // @(#)root/base:$Id: TVirtualPadEditor.cxx,v 1.0 2003/11/25
00002 // Author: Ilka Antcheva   25/11/03
00003 /*************************************************************************
00004  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00005  * All rights reserved.                                                  *
00006  *                                                                       *
00007  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00008  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00009  *************************************************************************/
00010 
00011 //////////////////////////////////////////////////////////////////////////
00012 //                                                                      //
00013 // TVirtualPadEditor                                                    //
00014 //                                                                      //
00015 // Abstract base class used by ROOT graphics editor                     //
00016 //                                                                      //
00017 //////////////////////////////////////////////////////////////////////////
00018 
00019 #include "TROOT.h"
00020 #include "TVirtualPadEditor.h"
00021 #include "TPluginManager.h"
00022 #include "TEnv.h"
00023 #include "TVirtualPad.h"
00024 
00025 TVirtualPadEditor *TVirtualPadEditor::fgPadEditor  = 0;
00026 TString            TVirtualPadEditor::fgEditorName = "";
00027 
00028 ClassImp(TVirtualPadEditor)
00029 
00030 //______________________________________________________________________________
00031 TVirtualPadEditor::TVirtualPadEditor()
00032 {
00033    // Virtual editor ctor.
00034 
00035 }
00036 
00037 //______________________________________________________________________________
00038 TVirtualPadEditor::~TVirtualPadEditor()
00039 {
00040    // Virtual editor dtor.
00041 
00042 }
00043 
00044 //______________________________________________________________________________
00045 TVirtualPadEditor *TVirtualPadEditor::LoadEditor()
00046 {
00047    // Static function returning a pointer to a new pad editor.
00048    // This pointer can be adopted by a TCanvas (i.e. TRootCanvas)
00049    // when it embeds the editor.
00050 
00051    TPluginHandler *h;
00052    if (fgEditorName.Length() == 0)
00053       fgEditorName = gEnv->GetValue("Root.PadEditor","Ged");
00054    h = gROOT->GetPluginManager()->FindHandler("TVirtualPadEditor",
00055                                               fgEditorName);
00056    if (h) {
00057       if (h->LoadPlugin() == -1)
00058          return 0;
00059       return (TVirtualPadEditor*) h->ExecPlugin(1, gPad ? gPad->GetCanvas() : 0);
00060    }
00061 
00062    return 0;
00063 }
00064 
00065 //______________________________________________________________________________
00066 const char *TVirtualPadEditor::GetEditorName()
00067 {
00068    // Returns the type of the default pad editor. Static method.
00069 
00070    return fgEditorName;
00071 }
00072 
00073 //______________________________________________________________________________
00074 TVirtualPadEditor *TVirtualPadEditor::GetPadEditor(Bool_t load)
00075 {
00076    // Returns the pad editor dialog. Static method.
00077 
00078    if (!fgPadEditor && load)
00079       fgPadEditor = LoadEditor();
00080 
00081    return fgPadEditor;
00082 }
00083 
00084 //______________________________________________________________________________
00085 void TVirtualPadEditor::SetPadEditorName(const char *name)
00086 {
00087    // Set type of default pad editor. Static method.
00088 
00089    if (fgEditorName == name) return;
00090    delete fgPadEditor;
00091    fgPadEditor = 0;
00092    fgEditorName = name;
00093 }
00094 
00095 //______________________________________________________________________________
00096 void TVirtualPadEditor::ShowEditor()
00097 {
00098    // Show the global pad editor. Static method.
00099 
00100    if (!fgPadEditor) {
00101       GetPadEditor();
00102       if (!fgPadEditor) return;
00103       fgPadEditor->SetGlobal(kTRUE);
00104    }
00105    fgPadEditor->Show();
00106 }
00107 
00108 //______________________________________________________________________________
00109 void TVirtualPadEditor::HideEditor()
00110 {
00111    //  Hide the pad editor. Static method.
00112 
00113    if (fgPadEditor)
00114       fgPadEditor->Hide();
00115 }
00116 
00117 //______________________________________________________________________________
00118 void TVirtualPadEditor::Terminate()
00119 {
00120    // Close the global pad editor. Static method.
00121 
00122    if (!fgPadEditor) return;
00123 
00124    delete fgPadEditor;
00125    fgPadEditor = 0;
00126 }
00127 
00128 //______________________________________________________________________________
00129 void TVirtualPadEditor::UpdateFillAttributes(Int_t color, Int_t style)
00130 {
00131    // Update fill attributes via the pad editor
00132 
00133    ShowEditor();
00134 
00135    if (fgPadEditor)
00136       fgPadEditor->FillAttributes(color, style);
00137 }
00138 
00139 //______________________________________________________________________________
00140 void TVirtualPadEditor::UpdateTextAttributes(Int_t align, Float_t angle,
00141                                              Int_t col, Int_t font, Float_t tsize)
00142 {
00143    // Update text attributes via the pad editor
00144 
00145    ShowEditor();
00146 
00147    if (fgPadEditor)
00148       fgPadEditor->TextAttributes(align, angle, col, font, tsize);
00149 }
00150 
00151 //______________________________________________________________________________
00152 void TVirtualPadEditor::UpdateLineAttributes(Int_t color, Int_t style,
00153                                              Int_t width)
00154 {
00155    // Update line attributes via the pad editor
00156 
00157    ShowEditor();
00158 
00159    if (fgPadEditor)
00160       fgPadEditor->LineAttributes(color, style, width);
00161 }
00162 
00163 //______________________________________________________________________________
00164 void TVirtualPadEditor::UpdateMarkerAttributes(Int_t color, Int_t style,
00165                                                Float_t msize)
00166 {
00167    // Update marker attributes via the pad editor
00168 
00169    ShowEditor();
00170 
00171    if (fgPadEditor)
00172       fgPadEditor->MarkerAttributes(color, style, msize);
00173 }

Generated on Tue Jul 5 14:11:24 2011 for ROOT_528-00b_version by  doxygen 1.5.1