TRootGuiFactory.cxx

Go to the documentation of this file.
00001 // @(#)root/gui:$Id: TRootGuiFactory.cxx 23115 2008-04-10 13:35:37Z rdm $
00002 // Author: Fons Rademakers   15/01/98
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 // TRootGuiFactory                                                      //
00015 //                                                                      //
00016 // This class is a factory for ROOT GUI components. It overrides        //
00017 // the member functions of the ABS TGuiFactory.                         //
00018 //                                                                      //
00019 //////////////////////////////////////////////////////////////////////////
00020 
00021 #include "TRootGuiFactory.h"
00022 #include "TRootApplication.h"
00023 #include "TRootCanvas.h"
00024 #include "TRootBrowserLite.h"
00025 #include "TRootContextMenu.h"
00026 #include "TRootControlBar.h"
00027 #include "TROOT.h"
00028 #include "TPluginManager.h"
00029 #include "TEnv.h"
00030 
00031 ClassImp(TRootGuiFactory)
00032 
00033 //______________________________________________________________________________
00034 TRootGuiFactory::TRootGuiFactory(const char *name, const char *title)
00035    : TGuiFactory(name, title)
00036 {
00037    // TRootGuiFactory ctor.
00038 }
00039 
00040 //______________________________________________________________________________
00041 TApplicationImp *TRootGuiFactory::CreateApplicationImp(const char *classname,
00042                       Int_t *argc, char **argv)
00043 {
00044    // Create a ROOT native GUI version of TApplicationImp
00045 
00046    TRootApplication *app = new TRootApplication(classname, argc, argv);
00047    if (!app->Client()) {
00048       delete app;
00049       app = 0;
00050    }
00051    return app;
00052 }
00053 
00054 //______________________________________________________________________________
00055 TCanvasImp *TRootGuiFactory::CreateCanvasImp(TCanvas *c, const char *title,
00056                                              UInt_t width, UInt_t height)
00057 {
00058    // Create a ROOT native GUI version of TCanvasImp
00059 
00060    return new TRootCanvas(c, title, width, height);
00061 }
00062 
00063 //______________________________________________________________________________
00064 TCanvasImp *TRootGuiFactory::CreateCanvasImp(TCanvas *c, const char *title,
00065                                   Int_t x, Int_t y, UInt_t width, UInt_t height)
00066 {
00067    // Create a ROOT native GUI version of TCanvasImp
00068 
00069    return new TRootCanvas(c, title, x, y, width, height);
00070 }
00071 
00072 //______________________________________________________________________________
00073 TBrowserImp *TRootGuiFactory::CreateBrowserImp(TBrowser *b, const char *title,
00074                                                UInt_t width, UInt_t height, 
00075                                                Option_t *opt)
00076 {
00077    // Create a ROOT native GUI version of TBrowserImp
00078 
00079    TString browserVersion(gEnv->GetValue("Browser.Name", "TRootBrowserLite"));
00080    TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TBrowserImp", 
00081                                                                browserVersion);
00082    TString browserOptions(gEnv->GetValue("Browser.Options", "FECI"));
00083    if (opt && strlen(opt))
00084       browserOptions = opt;
00085    browserOptions.ToUpper();
00086    if (browserOptions.Contains("LITE"))
00087       return new TRootBrowserLite(b, title, width, height);
00088    if (ph && ph->LoadPlugin() != -1) {
00089       TBrowserImp *imp = (TBrowserImp *)ph->ExecPlugin(5, b, title, width, 
00090          height, browserOptions.Data());
00091       if (imp) return imp;
00092    }
00093    return new TRootBrowserLite(b, title, width, height);
00094 }
00095 
00096 //______________________________________________________________________________
00097 TBrowserImp *TRootGuiFactory::CreateBrowserImp(TBrowser *b, const char *title,
00098                                                Int_t x, Int_t y, UInt_t width, 
00099                                                UInt_t height, Option_t *opt)
00100 {
00101    // Create a ROOT native GUI version of TBrowserImp
00102 
00103    TString browserVersion(gEnv->GetValue("Browser.Name", "TRootBrowserLite"));
00104    TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TBrowserImp", 
00105                                                                browserVersion);
00106    TString browserOptions(gEnv->GetValue("Browser.Options", "FECI"));
00107    if (opt && strlen(opt))
00108       browserOptions = opt;
00109    browserOptions.ToUpper();
00110    if (browserOptions.Contains("LITE"))
00111       return new TRootBrowserLite(b, title, width, height);
00112    if (ph && ph->LoadPlugin() != -1) {
00113       TBrowserImp *imp = (TBrowserImp *)ph->ExecPlugin(7, b, title, x, y, width, 
00114          height, browserOptions.Data());
00115       if (imp) return imp;
00116    }
00117    return new TRootBrowserLite(b, title, x, y, width, height);
00118 }
00119 
00120 //______________________________________________________________________________
00121 TContextMenuImp *TRootGuiFactory::CreateContextMenuImp(TContextMenu *c,
00122                                              const char *name, const char *)
00123 {
00124    // Create a ROOT native GUI version of TContextMenuImp
00125 
00126    return new TRootContextMenu(c, name);
00127 }
00128 
00129 //______________________________________________________________________________
00130 TControlBarImp *TRootGuiFactory::CreateControlBarImp(TControlBar *c, const char *title)
00131 {
00132    // Create a ROOT native GUI version of TControlBarImp
00133 
00134    return new TRootControlBar(c, title);
00135 }
00136 
00137 //______________________________________________________________________________
00138 TControlBarImp *TRootGuiFactory::CreateControlBarImp(TControlBar *c, const char *title,
00139                                                      Int_t x, Int_t y)
00140 {
00141    // Create a ROOT native GUI version of TControlBarImp
00142 
00143    return new TRootControlBar(c, title, x, y);
00144 }

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