00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00038 }
00039
00040
00041 TApplicationImp *TRootGuiFactory::CreateApplicationImp(const char *classname,
00042 Int_t *argc, char **argv)
00043 {
00044
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
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
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
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
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
00125
00126 return new TRootContextMenu(c, name);
00127 }
00128
00129
00130 TControlBarImp *TRootGuiFactory::CreateControlBarImp(TControlBar *c, const char *title)
00131 {
00132
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
00142
00143 return new TRootControlBar(c, title, x, y);
00144 }