Logo ROOT   6.18/05
Reference Guide
TRootGuiFactory.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 15/01/98
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//////////////////////////////////////////////////////////////////////////
13// //
14// TRootGuiFactory //
15// //
16// This class is a factory for ROOT GUI components. It overrides //
17// the member functions of the ABS TGuiFactory. //
18// //
19//////////////////////////////////////////////////////////////////////////
20
21#include "TRootGuiFactory.h"
22#include "TRootApplication.h"
23#include "TRootCanvas.h"
24#include "TRootBrowser.h"
25#include "TRootBrowserLite.h"
26#include "TRootContextMenu.h"
27#include "TRootControlBar.h"
28#include "TROOT.h"
29#include "TPluginManager.h"
30#include "TEnv.h"
31
33
34////////////////////////////////////////////////////////////////////////////////
35/// TRootGuiFactory ctor.
36
37TRootGuiFactory::TRootGuiFactory(const char *name, const char *title)
38 : TGuiFactory(name, title)
39{
40}
41
42////////////////////////////////////////////////////////////////////////////////
43/// Create a ROOT native GUI version of TApplicationImp
44
46 Int_t *argc, char **argv)
47{
48 TRootApplication *app = new TRootApplication(classname, argc, argv);
49 if (!app->Client()) {
50 delete app;
51 app = 0;
52 }
53 return app;
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Create a ROOT native GUI version of TCanvasImp
58
60 UInt_t width, UInt_t height)
61{
62 return new TRootCanvas(c, title, width, height);
63}
64
65////////////////////////////////////////////////////////////////////////////////
66/// Create a ROOT native GUI version of TCanvasImp
67
69 Int_t x, Int_t y, UInt_t width, UInt_t height)
70{
71 return new TRootCanvas(c, title, x, y, width, height);
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// Create a ROOT native GUI version of TBrowserImp
76
78 UInt_t width, UInt_t height,
79 Option_t *opt)
80{
81 TString browserVersion(gEnv->GetValue("Browser.Name", "TRootBrowserLite"));
82 TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TBrowserImp",
83 browserVersion);
84 TString browserOptions(gEnv->GetValue("Browser.Options", "FECI"));
85 if (opt && strlen(opt))
86 browserOptions = opt;
87 browserOptions.ToUpper();
88 if (browserOptions.Contains("LITE"))
89 return new TRootBrowserLite(b, title, width, height);
90 if (ph && ph->LoadPlugin() != -1) {
91 TBrowserImp *imp = (TBrowserImp *)ph->ExecPlugin(5, b, title, width,
92 height, browserOptions.Data());
93 if (imp) return imp;
94 }
95 if (browserVersion.Contains("Lite", TString::kIgnoreCase))
96 return new TRootBrowserLite(b, title, width, height);
97 else
98 return new TRootBrowser(b, title, width, height, browserOptions.Data());
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Create a ROOT native GUI version of TBrowserImp
103
106 UInt_t height, Option_t *opt)
107{
108 TString browserVersion(gEnv->GetValue("Browser.Name", "TRootBrowserLite"));
109 TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TBrowserImp",
110 browserVersion);
111 TString browserOptions(gEnv->GetValue("Browser.Options", "FECI"));
112 if (opt && strlen(opt))
113 browserOptions = opt;
114 browserOptions.ToUpper();
115 if (browserOptions.Contains("LITE"))
116 return new TRootBrowserLite(b, title, width, height);
117 if (ph && ph->LoadPlugin() != -1) {
118 TBrowserImp *imp = (TBrowserImp *)ph->ExecPlugin(7, b, title, x, y, width,
119 height, browserOptions.Data());
120 if (imp) return imp;
121 }
122 if (browserVersion.Contains("Lite", TString::kIgnoreCase))
123 return new TRootBrowserLite(b, title, x, y, width, height);
124 else
125 return new TRootBrowser(b, title, x, y, width, height, browserOptions.Data());
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Create a ROOT native GUI version of TContextMenuImp
130
132 const char *name, const char *)
133{
134 return new TRootContextMenu(c, name);
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// Create a ROOT native GUI version of TControlBarImp
139
141{
142 return new TRootControlBar(c, title);
143}
144
145////////////////////////////////////////////////////////////////////////////////
146/// Create a ROOT native GUI version of TControlBarImp
147
149 Int_t x, Int_t y)
150{
151 return new TRootControlBar(c, title, x, y);
152}
#define b(i)
Definition: RSha256.hxx:100
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
R__EXTERN TEnv * gEnv
Definition: TEnv.h:171
char name[80]
Definition: TGX11.cxx:109
#define gROOT
Definition: TROOT.h:414
ABC describing GUI independent application implementation protocol.
ABC describing GUI independent browser implementation protocol.
Definition: TBrowserImp.h:29
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
Definition: TCanvasImp.h:30
The Canvas class.
Definition: TCanvas.h:31
This class provides an interface to GUI independent context sensitive popup menus.
This class provides an interface to context sensitive popup menus.
Definition: TContextMenu.h:40
ABC describing GUI independent control bar.
A Control Bar is a fully user configurable tool which provides fast access to frequently used operati...
Definition: TControlBar.h:22
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Definition: TEnv.cxx:491
This ABC is a factory for GUI components.
Definition: TGuiFactory.h:42
Long_t ExecPlugin(int nargs, const T &... params)
Int_t LoadPlugin()
Load the plugin library for this handler.
TGClient * Client() const
virtual TCanvasImp * CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height)
Create a ROOT native GUI version of TCanvasImp.
TRootGuiFactory(const char *name="Root", const char *title="ROOT GUI Factory")
TRootGuiFactory ctor.
virtual TApplicationImp * CreateApplicationImp(const char *classname, int *argc, char **argv)
Create a ROOT native GUI version of TApplicationImp.
virtual TBrowserImp * CreateBrowserImp(TBrowser *b, const char *title, UInt_t width, UInt_t height, Option_t *opt="")
Create a ROOT native GUI version of TBrowserImp.
virtual TControlBarImp * CreateControlBarImp(TControlBar *c, const char *title)
Create a ROOT native GUI version of TControlBarImp.
virtual TContextMenuImp * CreateContextMenuImp(TContextMenu *c, const char *name, const char *title)
Create a ROOT native GUI version of TContextMenuImp.
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
@ kIgnoreCase
Definition: TString.h:263
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1138
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17