Logo ROOT  
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/** \class TRootGuiFactory
14 \ingroup guiwidgets
15
16This class is a factory for ROOT GUI components. It overrides
17the member functions of the ABS TGuiFactory.
18
19*/
20
21
22#include "TRootGuiFactory.h"
23#include "TRootApplication.h"
24#include "TRootCanvas.h"
25#include "TRootBrowser.h"
26#include "TRootBrowserLite.h"
27#include "TRootContextMenu.h"
28#include "TRootControlBar.h"
29#include "TROOT.h"
30#include "TPluginManager.h"
31#include "TEnv.h"
32
34
35////////////////////////////////////////////////////////////////////////////////
36/// TRootGuiFactory ctor.
37
38TRootGuiFactory::TRootGuiFactory(const char *name, const char *title)
39 : TGuiFactory(name, title)
40{
41}
42
43////////////////////////////////////////////////////////////////////////////////
44/// Create a ROOT native GUI version of TApplicationImp
45
47 Int_t *argc, char **argv)
48{
49 TRootApplication *app = new TRootApplication(classname, argc, argv);
50 if (!app->Client()) {
51 delete app;
52 app = 0;
53 }
54 return app;
55}
56
57////////////////////////////////////////////////////////////////////////////////
58/// Create a ROOT native GUI version of TCanvasImp
59
61 UInt_t width, UInt_t height)
62{
63 return new TRootCanvas(c, title, width, height);
64}
65
66////////////////////////////////////////////////////////////////////////////////
67/// Create a ROOT native GUI version of TCanvasImp
68
70 Int_t x, Int_t y, UInt_t width, UInt_t height)
71{
72 return new TRootCanvas(c, title, x, y, width, height);
73}
74
75////////////////////////////////////////////////////////////////////////////////
76/// Create a ROOT native GUI version of TBrowserImp
77
79 UInt_t width, UInt_t height,
80 Option_t *opt)
81{
82 TString browserVersion(gEnv->GetValue("Browser.Name", "TRootBrowserLite"));
83 TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TBrowserImp",
84 browserVersion);
85 TString browserOptions(gEnv->GetValue("Browser.Options", "FECI"));
86 if (opt && strlen(opt))
87 browserOptions = opt;
88 browserOptions.ToUpper();
89 if (browserOptions.Contains("LITE"))
90 return new TRootBrowserLite(b, title, width, height);
91 if (ph && ph->LoadPlugin() != -1) {
92 TBrowserImp *imp = (TBrowserImp *)ph->ExecPlugin(5, b, title, width,
93 height, browserOptions.Data());
94 if (imp) return imp;
95 }
96 if (browserVersion.Contains("Lite", TString::kIgnoreCase))
97 return new TRootBrowserLite(b, title, width, height);
98 else
99 return new TRootBrowser(b, title, width, height, browserOptions.Data());
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// Create a ROOT native GUI version of TBrowserImp
104
107 UInt_t height, Option_t *opt)
108{
109 TString browserVersion(gEnv->GetValue("Browser.Name", "TRootBrowserLite"));
110 TPluginHandler *ph = gROOT->GetPluginManager()->FindHandler("TBrowserImp",
111 browserVersion);
112 TString browserOptions(gEnv->GetValue("Browser.Options", "FECI"));
113 if (opt && strlen(opt))
114 browserOptions = opt;
115 browserOptions.ToUpper();
116 if (browserOptions.Contains("LITE"))
117 return new TRootBrowserLite(b, title, width, height);
118 if (ph && ph->LoadPlugin() != -1) {
119 TBrowserImp *imp = (TBrowserImp *)ph->ExecPlugin(7, b, title, x, y, width,
120 height, browserOptions.Data());
121 if (imp) return imp;
122 }
123 if (browserVersion.Contains("Lite", TString::kIgnoreCase))
124 return new TRootBrowserLite(b, title, x, y, width, height);
125 else
126 return new TRootBrowser(b, title, x, y, width, height, browserOptions.Data());
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Create a ROOT native GUI version of TContextMenuImp
131
133 const char *name, const char *)
134{
135 return new TRootContextMenu(c, name);
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// Create a ROOT native GUI version of TControlBarImp
140
142{
143 return new TRootControlBar(c, title);
144}
145
146////////////////////////////////////////////////////////////////////////////////
147/// Create a ROOT native GUI version of TControlBarImp
148
150 Int_t x, Int_t y)
151{
152 return new TRootControlBar(c, title, x, y);
153}
#define b(i)
Definition: RSha256.hxx:100
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:364
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
R__EXTERN TEnv * gEnv
Definition: TEnv.h:170
char name[80]
Definition: TGX11.cxx:110
#define gROOT
Definition: TROOT.h:404
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:23
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:44
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:26
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
Longptr_t ExecPlugin(int nargs, const T &... params)
Int_t LoadPlugin()
Load the plugin library for this handler.
This class create the ROOT native GUI version of the ROOT application environment.
TGClient * Client() const
This class creates a ROOT object browser (looking like Windows Explorer).
This class creates a ROOT object browser, constituted by three main tabs.
Definition: TRootBrowser.h:54
This class creates a main window with menubar, scrollbars and a drawing area.
Definition: TRootCanvas.h:34
This class provides an interface to context sensitive popup menus.
This class provides an interface to the GUI dependent functions of the TControlBar class.
This class is a factory for ROOT GUI components.
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:136
const char * Data() const
Definition: TString.h:369
@ kIgnoreCase
Definition: TString.h:268
void ToUpper()
Change string to upper case.
Definition: TString.cxx:1163
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17